0lai0 opened a new pull request, #3668:
URL: https://github.com/apache/datafusion-comet/pull/3668

   ## Which issue does this PR close?
   
   Closes #3342 
   
   ## Rationale for this change
   
   When ConstantFolding is disabled, literal trunc() and date_trunc() calls 
reach the native engine with both arguments as Scalar. The existing match arms 
only handled (Array, Scalar) and (Array, Array) , so the (Scalar, Scalar) case 
fell through to the error branch and crashed.
   
   ## What changes are included in this PR?
   
   - Use into_array(num_rows) to convert the date argument to an Array before 
matching on format, so all input combinations are handled uniformly.
   
   - Convert the timestamp argument to an Array via into_array(num_rows) before 
matching on format.
   
   ## How are these changes tested?
   
   <!--
   We typically require tests for all PRs in order to:
   1. Prevent the code from being accidentally broken by subsequent changes
   2. Serve as another way to document the expected behavior of the code
   
   If tests are not included in your PR, please explain why (for example, are 
they covered by existing tests)?
   -->
   Added test cases in `CometTemporalExpressionSuite` that disable 
ConstantFolding and verify literal `trunc()` and `date_trunc()` queries execute 
correctly on Comet and produce results matching 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]

Reply via email to