Skip to content

Move static support decisions from serde convert into getSupportLevel #4673

Description

@andygrove

Background

The serde framework intends that an expression declares whether it can be accelerated through getSupportLevel, which returns Compatible, Incompatible, or Unsupported. The central dispatcher in QueryPlanSerde then translates Incompatible/Unsupported into the appropriate withFallbackReason fallback.

Several CometExpressionSerde.convert (and CometAggregateExpressionSerde.convert) implementations instead call withFallbackReason directly for decisions that are statically determinable from the expression (data types, negative decimal scale, whether an argument is a literal/foldable, etc.). Those decisions belong in getSupportLevel.

Calling withFallbackReason inside convert is only appropriate when rolling up child fallback reasons after a child failed to convert, or when the decision genuinely cannot be made until conversion is attempted. Note that getSupportLevel(expr) receives only the expression: checks that need inputs/binding (for example resolving an attribute against the input schema) must remain in convert.

Scope

Move static support decisions out of convert and into getSupportLevel across the expression and aggregate serdes. This is a behavior-preserving refactor: each case that previously fell back to Spark continues to fall back with the same reason.

This will be done as a series of PRs grouped by serde domain:

  • Arithmetic and math expressions (arithmetic.scala, math.scala)
  • String expressions (strings.scala)
  • Array expressions (arrays.scala)
  • Aggregate expressions (aggregates.scala)
  • Misc scalar serdes (namedExpressions.scala, unixtime.scala, contraintExpressions.scala)

The cast path (CometCast) and the operator/scan/rule layers are out of scope: they do not have a getSupportLevel(expr) hook.

Metadata

Metadata

Assignees

Labels

area:expressionsExpression evaluationenhancementNew feature or requestpriority:lowMinor issues, test failures, tooling, cosmetic

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions