feat: opt timezone expressions into codegen dispatch#4638
Open
andygrove wants to merge 2 commits into
Open
Conversation
… codegen dispatch Mixes CodegenDispatchFallback into the three timezone serdes so their Incompatible result (the native parser rejects legacy zone forms like PST / GMT+1, apache#2013) routes through the JVM codegen dispatcher and matches Spark exactly, including those forms, instead of falling back. The native path stays opt-in via allowIncompatible. Part of apache#4596.
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?
Part of #4596 (the timezone group:
from_utc_timestamp,to_utc_timestamp,convert_timezone).Rationale for this change
All three report
Incompatiblefor the same reason: Comet's native timezone parser does not accept Spark's legacy zone forms (PST,GMT+1,UTC+1, ...), so those throw a native parse error (#2013). WithallowIncompatibleunset the whole projection falls back to Spark. They have a real SparkdoGenCodeand supported input/output types, so they are eligible for theCodegenDispatchFallbackpath: route theIncompatibleresult through the JVM codegen dispatcher (Spark's owndoGenCodeinside the Comet pipeline) so the projection stays native, matches Spark exactly, and handles every timezone form.What changes are included in this PR?
CometFromUTCTimestamp,CometToUTCTimestamp,CometConvertTimezonemix inCodegenDispatchFallback. The native incompatible path stays opt-in viaallowIncompatible.docs/source/user-guide/latest/expressions.mdnotes updated: these route through the dispatcher by default and now handle all timezone forms.How are these changes tested?
New
from_utc_timestamp_dispatch.sql,to_utc_timestamp_dispatch.sql, andconvert_timezone_dispatch.sql, each withallowIncompatibleunset and aConfigMatrix: spark.sql.session.timeZone=UTC,America/Los_Angeles. They assert native execution matching Spark across both session zones (confirming the resolvedtimeZoneIdsurvives closure serialization, the concern called out in the issue), and include the legacyPST/GMT+1forms the native path rejects but the dispatcher handles. The existingallowIncompatible=truenative-path tests still pass. All run withCometSqlFileTestSuiteon Spark 3.5.