feat: Support Spark expression seconds_of_time#3618
Open
0lai0 wants to merge 10 commits intoapache:mainfrom
Open
feat: Support Spark expression seconds_of_time#36180lai0 wants to merge 10 commits intoapache:mainfrom
0lai0 wants to merge 10 commits intoapache:mainfrom
Conversation
martin-g
reviewed
Mar 2, 2026
| } | ||
| } | ||
|
|
||
| def secondOfTimeToProto( |
Member
There was a problem hiding this comment.
This method should probably be moved to datetime.scala instead.
Contributor
Author
There was a problem hiding this comment.
Thanks for the feedback. I'll make changes based on your comment.
| // Right child is the encoding expression. | ||
| stringDecode(expr, s.charset, s.bin, inputs, binding) | ||
|
|
||
| case _ if expr.getClass.getSimpleName == "SecondOfTime" => |
Member
There was a problem hiding this comment.
- Using the simpleName could return
truefor a totally unrelated class - It seems you have not tested your suggested changes because the name of the class is SecondsOfTime (https://github.com/apache/spark/blob/b38e8eaece84e80687ab1f707859c1e5ee7e4c9f/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/timeExpressions.scala#L354)
Contributor
Author
There was a problem hiding this comment.
Thanks for review. Sorry to miss 's', I will fix it in next commit.
Co-authored-by: Martin Grigorov <martin-g@users.noreply.github.com>
martin-g
reviewed
Mar 3, 2026
martin-g
reviewed
Mar 5, 2026
spark/src/main/spark-3.4/org/apache/comet/shims/CometExprShim.scala
Outdated
Show resolved
Hide resolved
spark/src/main/spark-3.5/org/apache/comet/shims/CometExprShim.scala
Outdated
Show resolved
Hide resolved
spark/src/main/spark-4.0/org/apache/comet/shims/CometExprShim.scala
Outdated
Show resolved
Hide resolved
…scala Co-authored-by: Martin Grigorov <martin-g@users.noreply.github.com>
…scala Co-authored-by: Martin Grigorov <martin-g@users.noreply.github.com>
…scala Co-authored-by: Martin Grigorov <martin-g@users.noreply.github.com>
Contributor
Author
|
Thanks @martin-g for pointing that out. |
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 #3129
Rationale for this change
Comet previously did not support the Spark
SecondsOfTimeexpression, so queries using second(time_expr) could fall back to JVM execution instead of running natively.What changes are included in this PR?
This change adds a Serde handler for SecondsOfTime that reuses the existing Second protobuf and Rust implementation, ensuring consistent behavior while avoiding new native code paths.
How are these changes tested?
Added a Scala unit test SecondsOfTime expression support in CometExpressionSuite
./mvnw test -Dsuites="org.apache.comet.CometSqlFileTestSuite hour,org.apache.comet.CometExpressionSuite second" -Dtest=none./mvnw clean compile -DskipTests