Skip to content

feat(serde): introduce structured SupportCondition for expression support-level metadata#4052

Closed
andygrove wants to merge 10 commits intoapache:mainfrom
andygrove:feat/issue-4050-audit-compat
Closed

feat(serde): introduce structured SupportCondition for expression support-level metadata#4052
andygrove wants to merge 10 commits intoapache:mainfrom
andygrove:feat/issue-4050-audit-compat

Conversation

@andygrove
Copy link
Copy Markdown
Member

@andygrove andygrove commented Apr 23, 2026

Which issue does this PR close?

Part of #4050.

Rationale for this change

Issue #4050 asks for a single source of truth for Spark expression compatibility that can drive doc generation and cross-version audits. This PR lays the data-model foundation: a structured SupportCondition type whose instances are enumerable at build time. Free-form getSupportLevel require manual effort to keep in sync with documentation.

What changes are included in this PR?

  • New SupportCondition[-T <: Expression] trait + SupportLevelKind sum type in SupportLevel.scala, with builder helpers (apply, unsupported, incompatible, compatibleWithNote).
  • CometExpressionSerde[T] gains conditions: Seq[SupportCondition[T]]. Default getSupportLevel is derived from it (first-match-wins, falls back to Compatible(None)).
  • Existing serdes that override getSupportLevel continue to work unchanged.
  • Proof-of-concept migration of CometLength (single condition) and CometSortArray (two ordered conditions, one config-dependent).

Deferred to follow-up PRs: backfilling remaining serdes, aggregation across serde registry, doc generation, CI consistency checks, Spark-version metadata on conditions.

How are these changes tested?

New SupportConditionSuite with 12 unit tests covering: empty conditions, no match, first-match ordering, each SupportLevelKind, expression-dependent messages, and per-serde assertions for CometLength and CometSortArray (id / level / description). Existing CometStringExpressionSuite and CometArrayExpressionSuite pass unchanged, confirming observable behavior is preserved.

@andygrove andygrove closed this Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant