agg_funcs Expression Audits#
Audit notes for expressions in this category that have been audited. Absence of an entry means the expression has not been audited yet, not that it is unsupported. See the user guide Spark Expression Support for current support status.
any#
Spark 3.4.3 (audited 2026-05-26): registered as a SQL alias of
BoolOr, which extendsRuntimeReplaceableAggregatewithreplacement = Max(child). Catalyst rewritesany(x)tomax(x)before Comet sees the plan, soanyis served byCometMaxon aBooleanTypecolumn.Spark 3.5.8 (audited 2026-05-26): identical to 3.4.3.
Spark 4.0.1 (audited 2026-05-26): identical to 3.4.3.
avg#
Spark 3.4.3 (2026-05-26)
Spark 3.5.8 (2026-05-26): aggregate logic identical to 3.4.3
Spark 4.0.1 (2026-05-26): aggregate logic identical to 3.5.8; only
QueryContextimport path differs.YearMonthIntervalTypeandDayTimeIntervalTypeinputs (supported by Spark) fall back to Spark in Comet.
bit_and#
Spark 3.4.3 (2026-05-26)
Spark 3.5.8 (2026-05-26)
Spark 4.0.1 (2026-05-26)
median#
Spark 3.4.3 (audited 2026-06-24):
Median(child)is aRuntimeReplaceableAggregatewithreplacement = Percentile(child, Literal(0.5)). Catalyst rewritesmedian(x)topercentile(x, 0.5)before Comet sees the plan, so it is served byCometPercentile.Spark 3.5.8 (audited 2026-06-24): identical to 3.4.3.
Spark 4.0.1 (audited 2026-06-24):
replacementbecomeslazy val; semantics unchanged.Spark 4.1.1 (audited 2026-06-24): identical to 4.0.1.
percentile#
Spark 3.4.3 (audited 2026-06-24):
Percentile(child, percentageExpression, frequencyExpression, ..., reverse)overPercentileBase. Exact percentile usingindex = p * (n - 1)linear interpolation, NULL inputs skipped, empty/all-null group returns NULL.CometPercentilemaps the single-literal-percentage, default-frequency, numeric-input, ascending form to DataFusion’spercentile_cont(same interpolation). Array-of-percentages, a non-default frequency argument, descending order, and interval inputs fall back to Spark.Spark 3.5.8 (audited 2026-06-24): ordering centralized via
PhysicalDataType.ordering; behavior identical to 3.4.3.Spark 4.0.1 (audited 2026-06-24): adds
PercentileCont/PercentileDiscbuilders andSupportsOrderingWithinGroup, enablingpercentile_cont(p) WITHIN GROUP (ORDER BY col), which rewrites toPercentile(col, p, reverse). The ascending form runs natively; theDESCform setsreverse = trueand falls back to Spark because the nativepercentile_contalways interpolates in ascending order.Spark 4.1.1 (audited 2026-06-24): identical to 4.0.1.
CometPercentilereportsIncompatiblefor the otherwise-supported form because DataFusion’spercentile_contquantizes the interpolation weight to 6 decimal places (INTERPOLATION_PRECISION = 1e6), so a deeply-interpolated value can differ from Spark by up to roughly(upper - lower) * 1e-6. The native path is opt-in viaspark.comet.expression.Percentile.allowIncompatible=true(#4719).