chore(audit): audit remaining array expressions across Spark 3.4.3, 3.5.8, 4.0.1, 4.1.1#4483
Open
andygrove wants to merge 1 commit into
Open
chore(audit): audit remaining array expressions across Spark 3.4.3, 3.5.8, 4.0.1, 4.1.1#4483andygrove wants to merge 1 commit into
andygrove wants to merge 1 commit into
Conversation
….5.8, 4.0.1, 4.1.1 Add per-version audit sub-bullets to all 19 not-yet-audited array expressions: `array`, `array_append`, `array_compact`, `array_contains`, `array_distinct`, `array_except`, `array_join`, `array_max`, `array_min`, `array_position`, `array_remove`, `array_repeat`, `array_union`, `arrays_overlap`, `arrays_zip`, `element_at`, `flatten`, `get`, `sort_array`. Also add the 4.1.1 audit line to the already-audited `array_insert` and `array_intersect`. Highlights from the cross-version review: - Spark 4.0 across the category does the `NullIntolerant` -> `nullIntolerant` field refactor and (for elements participating in collation) widens `StringType` inputs to `StringTypeWithCollation`. - `ArrayAppend` becomes `RuntimeReplaceable` in 4.0 (rewrites to `ArrayInsert(arr, -1, elem)`); `CometArrayAppend` is unreachable in 4.0+. - `ArrayCompact` is always `RuntimeReplaceable`; Comet dispatches through `CometArrayFilter`. - `SortArray` 4.0 widens `ascendingOrder` from a `Literal` to any foldable boolean; `CometSortArray` still requires `Literal`. - `ElementAt` and `GetArrayItem` ANSI default flips to true in 4.0. Apply two support-level consistency fixes surfaced by the audit: - `CometArrayExcept`: `Incompatible(None)` -> `Incompatible(Some(reason))` via a shared `private val` so the EXPLAIN message matches the compatibility-guide text. - `CometArrayJoin`: same fix. Tracking issues filed for the correctness gaps found: - apache#4481 `array_distinct` / `array_union` / `array_except` do not canonicalize NaN / signed-zero like Spark's `SQLOpenHashSet`. - apache#4482 `array_max` / `array_min` disagree with Spark on NaN ordering. Existing apache#3178 already documents the `array_join` null-handling gap and is referenced from the `array_join` sub-bullet.
This was referenced May 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Closes #.
Rationale for this change
Continuation of the per-category expression audit. Same pattern as #4480 (predicate), #4479 (bitwise), #4478 (map), #4476 (hash), #4475 (conditional), #4474 (misc), #4473 (collection), #4470 (json), #4469 (struct), using the updated
audit-comet-expressionskill in #4468.What changes are included in this PR?
Support-doc audit notes
Add per-version audit sub-bullets to all 19 not-yet-audited array expressions (
array,array_append,array_compact,array_contains,array_distinct,array_except,array_join,array_max,array_min,array_position,array_remove,array_repeat,array_union,arrays_overlap,arrays_zip,element_at,flatten,get,sort_array). Add 4.1.1 audit lines to the already-auditedarray_insertandarray_intersect.Highlights from the cross-version review:
NullIntolerant->nullIntolerant: Booleanfield refactor and (for elements participating in collation) widensStringTypeinputs toStringTypeWithCollation.ArrayAppendbecomesRuntimeReplaceablein 4.0 (rewrites toArrayInsert(arr, -1, elem));CometArrayAppendis unreachable in 4.0+.ArrayCompactis alwaysRuntimeReplaceable; Comet dispatches throughCometArrayFilter.SortArray4.0 widensascendingOrderfrom aLiteralto any foldable boolean;CometSortArraystill requiresLiteral.ElementAtandGetArrayItemANSI default flips to true in 4.0.Support-level consistency fixes (in
arrays.scala)CometArrayExcept:Incompatible(None)->Incompatible(Some(reason))via a sharedprivate valso the EXPLAIN message matches the compatibility-guide text.CometArrayJoin: same fix.Tracking issues filed for follow-up
array_distinct/array_union/array_exceptdo not canonicalize NaN / signed-zero like Spark'sSQLOpenHashSet.array_max/array_mindisagree with Spark on NaN ordering.Existing #3178 already documents the
array_joinnull-handling gap and is referenced from thearray_joinsub-bullet. Other findings from the audit (e.g. lifting convert-time restrictions intogetSupportLevelforCometArrayPosition,CometArrayRemove,CometElementAt,CometFlatten,CometSortArray.ascendingOrder-foldable; relabelingCometArrayCompact/CometArrayAppenddead registrations) are noted in the doc but are too invasive for this audit PR; they can ride in follow-ups.Audit process
Audited using the
audit-comet-expressionskill (4 Spark versions per #4468), driven by 3 parallel agents covering creation/access, set/search, and aggregate/misc groups.How are these changes tested?
./mvnw test -Dsuites="org.apache.comet.CometArrayExpressionSuite" -Dtest=none(39 tests pass)./mvnw test -Dsuites="org.apache.comet.CometSqlFileTestSuite expressions/array/" -Dtest=none(34 tests pass)make coresucceeds.