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

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


The following commit(s) were added to refs/heads/main by this push:
     new 8ff22d9df [VL] Fix year_of_week function (#5386)
8ff22d9df is described below

commit 8ff22d9df1a8609579fbb0b9e76c63cc4b08bbe9
Author: PHILO-HE <[email protected]>
AuthorDate: Mon Apr 29 08:33:23 2024 +0800

    [VL] Fix year_of_week function (#5386)
---
 .../org/apache/gluten/execution/ScalarFunctionsValidateSuite.scala | 7 ++++++-
 cpp/velox/substrait/SubstraitToVeloxExpr.cc                        | 2 +-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git 
a/backends-velox/src/test/scala/org/apache/gluten/execution/ScalarFunctionsValidateSuite.scala
 
b/backends-velox/src/test/scala/org/apache/gluten/execution/ScalarFunctionsValidateSuite.scala
index b1f01537d..84f580b0b 100644
--- 
a/backends-velox/src/test/scala/org/apache/gluten/execution/ScalarFunctionsValidateSuite.scala
+++ 
b/backends-velox/src/test/scala/org/apache/gluten/execution/ScalarFunctionsValidateSuite.scala
@@ -757,13 +757,18 @@ class ScalarFunctionsValidateSuite extends 
FunctionsValidateTest {
     }
   }
 
-  test("weekofyear") {
+  test("extract date field") {
     withTable("t") {
       sql("create table t (dt date) using parquet")
       sql("insert into t values(date '2008-02-20')")
       runQueryAndCompare("select weekofyear(dt) from t") {
         checkGlutenOperatorMatch[ProjectExecTransformer]
       }
+      runQueryAndCompare(
+        "SELECT date_part('yearofweek', dt), extract(yearofweek from dt)" +
+          " from t") {
+        checkGlutenOperatorMatch[ProjectExecTransformer]
+      }
     }
   }
 
diff --git a/cpp/velox/substrait/SubstraitToVeloxExpr.cc 
b/cpp/velox/substrait/SubstraitToVeloxExpr.cc
index 8c8af593a..03e91ac42 100644
--- a/cpp/velox/substrait/SubstraitToVeloxExpr.cc
+++ b/cpp/velox/substrait/SubstraitToVeloxExpr.cc
@@ -624,6 +624,6 @@ std::unordered_map<std::string, std::string> 
SubstraitVeloxExprConverter::extrac
     {"QUARTER", "quarter"},
     {"YEAR", "year"},
     {"WEEK_OF_YEAR", "week_of_year"},
-    {"YEAR_OF_WEEK", "week_of_year"}};
+    {"YEAR_OF_WEEK", "year_of_week"}};
 
 } // namespace gluten


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

Reply via email to