refactor: move AttributeReference, FromUnixTime and KnownFloatingPointNormalized expression support checks to getSupportLevel#4745
Draft
peterxcli wants to merge 1 commit into
Draft
Conversation
andygrove
reviewed
Jun 29, 2026
| override def getSupportLevel(expr: FromUnixTime): SupportLevel = Incompatible(None) | ||
| override def getSupportLevel(expr: FromUnixTime): SupportLevel = { | ||
| if (expr.format == Literal(TimestampFormatter.defaultPattern()) || | ||
| !CometConf.isExprAllowIncompat(getExprConfigName(expr))) { |
Member
There was a problem hiding this comment.
I'm confused about the reference to isExprAllowIncompat here. Typically we would just return Incompatible and then rely on the serde framework checkign this flag.
andygrove
reviewed
Jun 29, 2026
| // TODO: DataFusion supports only -8334601211038 <= sec <= 8210266876799 | ||
| // https://github.com/apache/datafusion/issues/16594 | ||
| object CometFromUnixTime extends CometExpressionSerde[FromUnixTime] with CodegenDispatchFallback { | ||
| private val unsupportedFormatReason = "Datetime pattern format is unsupported" |
Member
There was a problem hiding this comment.
Could you implement getUnsupportedReasons, referencing unsupportedFormatReason so that this gets generated into the docs?
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 #4673.
Rationale for this change
This finishes the misc scalar serde follow-up for #4673. These serdes still had static support decisions in
convert, even though the dispatcher expects those decisions to come fromgetSupportLevel.Binding-dependent failures and child fallback rollups still stay in
convert.What changes are included in this PR?
Move static support checks into
getSupportLevelfor:AttributeReference: unsupported data types.FromUnixTime: unsupported native datetime format when the incompatible native path is enabled, while keeping the default codegen-dispatch path unchanged.KnownFloatingPointNormalized: unsupported wrapped child data types.The remaining
withFallbackReasoncalls in these files are for child conversion or binding-dependent failures.How are these changes tested?
Added focused coverage in
CometExpressionSuitefor the misc scalar serdegetSupportLeveldecisions.Also ran:
./mvnw test -Pspark-3.5 -Pscala-2.12 -Dtest=none -Dsuites="org.apache.comet.CometExpressionSuite misc scalar serdes report static unsupported cases via getSupportLevel" -Dscalastyle.skip=true