-
Notifications
You must be signed in to change notification settings - Fork 313
chore: fix spark ansi sum incompatibility message #4111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
coderfender
wants to merge
6
commits into
apache:main
Choose a base branch
from
coderfender:fix_comet_sum_compatbility_level
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
caccc6d
fix_incorrect_compatiblity_msg_comet_sum
coderfender 54a83cb
fix_incorrect_compatiblity_msg_comet_sum
coderfender 2fdb835
fix_incorrect_compatiblity_msg_comet_sum
27a9e8e
update_null_check
85663bf
Merge branch 'main' into fix_comet_sum_compatbility_level
coderfender a057ceb
address_review_comments
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,12 +29,27 @@ import org.apache.comet.serde.QueryPlanSerde.{exprToProtoInternal, optExprWithIn | |
| // https://github.com/apache/datafusion/issues/16594 | ||
| object CometFromUnixTime extends CometExpressionSerde[FromUnixTime] { | ||
|
|
||
| override def getUnsupportedReasons(): Seq[String] = Seq( | ||
| "Only supports the default datetime format pattern `yyyy-MM-dd HH:mm:ss`") | ||
|
|
||
| override def getIncompatibleReasons(): Seq[String] = Seq( | ||
| "Only supports the default datetime format pattern `yyyy-MM-dd HH:mm:ss`." + | ||
| " DataFusion's valid timestamp range differs from Spark" + | ||
| "DataFusion's valid timestamp range differs from Spark" + | ||
| " (https://github.com/apache/datafusion/issues/16594)") | ||
|
|
||
| override def getSupportLevel(expr: FromUnixTime): SupportLevel = Incompatible(None) | ||
| override def getSupportLevel(expr: FromUnixTime): SupportLevel = { | ||
| expr.format match { | ||
| case Literal(fmt, _) => | ||
| val formatStr = fmt.toString | ||
|
coderfender marked this conversation as resolved.
|
||
| val defaultPattern = TimestampFormatter.defaultPattern | ||
| if (formatStr == defaultPattern) { | ||
| Incompatible(None) | ||
| } else { | ||
|
coderfender marked this conversation as resolved.
|
||
| Unsupported(Some(s"Datetime pattern format: $formatStr is unsupported")) | ||
| } | ||
| case _ => | ||
| Unsupported(Some("Datetime pattern format is unsupported")) | ||
|
coderfender marked this conversation as resolved.
Outdated
|
||
| } | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried to leverage the right reason to fallback based on the pattern here |
||
| } | ||
|
|
||
| override def convert( | ||
| expr: FromUnixTime, | ||
|
|
@@ -48,17 +63,18 @@ object CometFromUnixTime extends CometExpressionSerde[FromUnixTime] { | |
| val formatExpr = exprToProtoInternal(Literal("%Y-%m-%d %H:%M:%S"), inputs, binding) | ||
| val timeZone = exprToProtoInternal(Literal(expr.timeZoneId.orNull), inputs, binding) | ||
|
|
||
| if (expr.format != Literal(TimestampFormatter.defaultPattern)) { | ||
| withInfo(expr, "Datetime pattern format is unsupported") | ||
| None | ||
| } else if (secExpr.isDefined && formatExpr.isDefined) { | ||
| val timestampExpr = | ||
| scalarFunctionExprToProto("from_unixtime", Seq(secExpr, timeZone): _*) | ||
| val optExpr = scalarFunctionExprToProto("to_char", Seq(timestampExpr, formatExpr): _*) | ||
| optExprWithInfo(optExpr, expr, expr.sec, expr.format) | ||
| } else { | ||
| withInfo(expr, expr.sec, expr.format) | ||
| None | ||
| expr.format match { | ||
| case Literal(fmt, _) if fmt.toString != TimestampFormatter.defaultPattern => | ||
| withInfo(expr, "Datetime pattern format is unsupported") | ||
| None | ||
| case _ if secExpr.isDefined && formatExpr.isDefined => | ||
| val timestampExpr = | ||
| scalarFunctionExprToProto("from_unixtime", Seq(secExpr, timeZone): _*) | ||
| val optExpr = scalarFunctionExprToProto("to_char", Seq(timestampExpr, formatExpr): _*) | ||
| optExprWithInfo(optExpr, expr, expr.sec, expr.format) | ||
|
Comment on lines
+70
to
+74
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this code still reachable? |
||
| case _ => | ||
| withInfo(expr, expr.sec, expr.format) | ||
| None | ||
| } | ||
| } | ||
| } | ||
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.