peterxcli commented on code in PR #5135:
URL: https://github.com/apache/datafusion-comet/pull/5135#discussion_r3694448543


##########
spark/src/test/scala/org/apache/comet/CometHashExpressionSuite.scala:
##########
@@ -128,6 +130,24 @@ class CometHashExpressionSuite extends CometTestBase with 
AdaptiveSparkPlanHelpe
     }
   }
 
+  test("hash - calendar interval") {

Review Comment:
   remove this test and added sql test in 
https://github.com/apache/datafusion-comet/pull/5135/changes/d069c8a8d195d7b19695b0d269ad911bb9af577d



##########
native/spark-expr/src/hash_funcs/utils.rs:
##########
@@ -706,6 +706,23 @@ macro_rules! create_hashes_internal {
                         $hash_method
                     );
                 }
+                
DataType::Interval(arrow::datatypes::IntervalUnit::MonthDayNano) => {
+                    let array = col

Review Comment:
   - pulled this into `hash_array_interval_month_day_nano!` macro
   - added `IntervalUnit` to the `use arrow::datatypes::{DataType, TimeUnit};`



##########
spark/src/test/scala/org/apache/comet/CometHashExpressionSuite.scala:
##########
@@ -128,6 +130,24 @@ class CometHashExpressionSuite extends CometTestBase with 
AdaptiveSparkPlanHelpe
     }
   }
 
+  test("hash - calendar interval") {
+    withTempView("t") {
+      val rows = Seq(
+        Row(new CalendarInterval(14, 25, 18367008009L)),
+        Row(new CalendarInterval(0, 1, 0L)),
+        Row(new CalendarInterval(0, 2, 0L)),
+        Row(new CalendarInterval(-14, -25, -18367008009L)),
+        Row(null))

Review Comment:
   included in new sql test.



##########
native/spark-expr/src/hash_funcs/utils.rs:
##########
@@ -706,6 +706,23 @@ macro_rules! create_hashes_internal {
                         $hash_method
                     );
                 }
+                
DataType::Interval(arrow::datatypes::IntervalUnit::MonthDayNano) => {
+                    let array = col
+                        .as_any()
+                        .downcast_ref::<IntervalMonthDayNanoArray>()
+                        .unwrap();
+                    for (hash, value) in 
$hashes_buffer.iter_mut().zip(array.iter()) {
+                        if let Some(value) = value {
+                            // Match Spark's generated hash code, which omits 
the days field:
+                            // 
https://github.com/apache/spark/blob/710b3c45aab88bd14e51d49f400e2f31e3b65772/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/hash.scala#L420-L423

Review Comment:
   yes, pointed to v4.2.0



-- 
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