<!---
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
-->

# Aggregate Expressions

<!--BEGIN:EXPR_COMPAT[aggregate]-->

## Average

The following incompatibilities cause `Average` to fall back to Spark by default. Set `spark.comet.expression.Average.allowIncompatible=true` to enable Comet acceleration despite these differences.

- Falls back to Spark in ANSI mode. Supports all numeric inputs except decimal types.

## CollectSet

The following incompatibilities cause `CollectSet` to fall back to Spark by default. Set `spark.comet.expression.CollectSet.allowIncompatible=true` to enable Comet acceleration despite these differences.

- Comet deduplicates NaN values (treats `NaN == NaN`) while Spark treats each NaN as a distinct value. When `spark.comet.exec.strictFloatingPoint=true`, `collect_set` on floating-point types falls back to Spark unless `spark.comet.expression.CollectSet.allowIncompatible=true` is set.

## First

The following differences from Spark are always present and do not require any additional configuration:

- This function is not deterministic. Results may not match Spark.

## Last

The following differences from Spark are always present and do not require any additional configuration:

- This function is not deterministic. Results may not match Spark.

## Sum

The following incompatibilities cause `Sum` to fall back to Spark by default. Set `spark.comet.expression.Sum.allowIncompatible=true` to enable Comet acceleration despite these differences.

- Falls back to Spark in ANSI mode.
<!--END:EXPR_COMPAT-->
