This is an automated email from the ASF dual-hosted git repository.

rui-mo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gluten.git


The following commit(s) were added to refs/heads/main by this push:
     new 603f495d72 [GLUTEN-11622][VL] Enable hour(timestamp_ntz) native 
execution (#12064)
603f495d72 is described below

commit 603f495d72371f837f3452fcdc3c971de512431e
Author: Mariam AlMesfer <[email protected]>
AuthorDate: Thu Jun 18 11:13:57 2026 +0300

    [GLUTEN-11622][VL] Enable hour(timestamp_ntz) native execution (#12064)
    
    Co-authored-by: Mariam-Almesfer <[email protected]>
---
 .../gluten/functions/DateFunctionsValidateSuite.scala    |  7 ++-----
 .../gluten/extension/columnar/validator/Validators.scala | 16 +++++++++++++++-
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git 
a/backends-velox/src/test/scala/org/apache/gluten/functions/DateFunctionsValidateSuite.scala
 
b/backends-velox/src/test/scala/org/apache/gluten/functions/DateFunctionsValidateSuite.scala
index e5e25c88b6..47b3e5b692 100644
--- 
a/backends-velox/src/test/scala/org/apache/gluten/functions/DateFunctionsValidateSuite.scala
+++ 
b/backends-velox/src/test/scala/org/apache/gluten/functions/DateFunctionsValidateSuite.scala
@@ -599,12 +599,9 @@ class DateFunctionsValidateSuite extends 
FunctionsValidateSuite {
           checkGlutenPlan[BatchScanExecTransformer]
         }
 
-        // Ensures the fallback of unsupported function works.
+        // hour(timestamp_ntz) runs natively; output is int (no NTZ 
propagation).
         runQueryAndCompare("select hour(ts) from view") {
-          df =>
-            assert(collect(df.queryExecution.executedPlan) {
-              case p if p.isInstanceOf[ProjectExec] => p
-            }.nonEmpty)
+          checkGlutenPlan[ProjectExecTransformer]
         }
     }
   }
diff --git 
a/gluten-substrait/src/main/scala/org/apache/gluten/extension/columnar/validator/Validators.scala
 
b/gluten-substrait/src/main/scala/org/apache/gluten/extension/columnar/validator/Validators.scala
index 63ac832486..d063afc989 100644
--- 
a/gluten-substrait/src/main/scala/org/apache/gluten/extension/columnar/validator/Validators.scala
+++ 
b/gluten-substrait/src/main/scala/org/apache/gluten/extension/columnar/validator/Validators.scala
@@ -25,6 +25,7 @@ import 
org.apache.gluten.extension.columnar.offload.OffloadSingleNode
 import org.apache.gluten.sql.shims.SparkShimLoader
 
 import org.apache.spark.internal.Logging
+import org.apache.spark.sql.catalyst.expressions.Hour
 import org.apache.spark.sql.execution._
 import org.apache.spark.sql.execution.aggregate.{HashAggregateExec, 
ObjectHashAggregateExec, SortAggregateExec}
 import org.apache.spark.sql.execution.datasources.WriteFilesExec
@@ -270,7 +271,20 @@ object Validators {
           case p if HiveTableScanExecTransformer.isHiveTableScan(p) => true
           case _ => false
         }
-        if (isScan) {
+        val isHourOnNtz = plan match {
+          case p: ProjectExec =>
+            p.projectList.forall {
+              expr =>
+                (!containsNTZ(expr.dataType) &&
+                  !expr.references.exists(a => containsNTZ(a.dataType))) ||
+                expr.exists {
+                  case Hour(child, _) => containsNTZ(child.dataType)
+                  case _ => false
+                }
+            }
+          case _ => false
+        }
+        if (isScan || isHourOnNtz) {
           return pass()
         }
       }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to