0lai0 opened a new pull request, #3746: URL: https://github.com/apache/datafusion-comet/pull/3746
## Which issue does this PR close? <!-- We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123. --> Closes #3124 ## Rationale for this change Comet previously did not support the Spark Days expression. It is used internally by Spark for daily partitioning in Iceberg/Delta tables. Since Comet did not recognize this expression, queries involving Days would fall back to JVM execution. ## What changes are included in this PR? This change adds a Serde handler for Days that reuses the existing Cast protobuf and Rust implementation, requiring no new native code paths. - For `DateType` input: dates are internally stored as days since epoch, so a simple Cast(Date → Int) suffices (same approach as `CometUnixDate`). - For `TimestampType` input: uses a timezone-aware Cast(Timestamp → Date) via `CometCast.castToProto `(which respects the session timezone for correct date boundary determination), followed by Cast(Date → Int). The `Date → Int `cast is constructed directly as protobuf (bypassing `CometCast.castToProto`) because Spark's `isAlwaysCastToNull` intercepts `Date → Int` in LEGACY mode and would incorrectly return null. `datetime.scala` : Added CometDays handler `QueryPlanSerde.scala` : Registered the handler in temporalExpressions map `CometTemporalExpressionSuite.scala` : Added days test ## How are these changes tested? `./mvnw test -pl spark -Dsuites="org.apache.comet.CometTemporalExpressionSuite" -Dtest="none" -DfailIfNoTests=false ` `./mvnw scalastyle:check -pl spark ` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
