From 506c0a7cb697b224c4957376227c0fe2c814972a Mon Sep 17 00:00:00 2001 From: taiyang-li <654010905@qq.com> Date: Wed, 28 Aug 2024 14:56:35 +0800 Subject: [PATCH] support function arrays_zip --- .../scala/org/apache/gluten/utils/CHExpressionUtil.scala | 1 - .../gluten/execution/GlutenFunctionValidateSuite.scala | 7 +++++++ .../scalar_function_parser/CommonScalarFunctionParser.cpp | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/backends-clickhouse/src/main/scala/org/apache/gluten/utils/CHExpressionUtil.scala b/backends-clickhouse/src/main/scala/org/apache/gluten/utils/CHExpressionUtil.scala index 868e42a94a5a..c33fd4ee3918 100644 --- a/backends-clickhouse/src/main/scala/org/apache/gluten/utils/CHExpressionUtil.scala +++ b/backends-clickhouse/src/main/scala/org/apache/gluten/utils/CHExpressionUtil.scala @@ -197,7 +197,6 @@ object CHExpressionUtil { ENCODE -> EncodeDecodeValidator(), ARRAY_REPEAT -> DefaultValidator(), ARRAY_REMOVE -> DefaultValidator(), - ARRAYS_ZIP -> DefaultValidator(), DATE_FROM_UNIX_DATE -> DefaultValidator(), MONOTONICALLY_INCREASING_ID -> DefaultValidator(), SPARK_PARTITION_ID -> DefaultValidator(), diff --git a/backends-clickhouse/src/test/scala/org/apache/gluten/execution/GlutenFunctionValidateSuite.scala b/backends-clickhouse/src/test/scala/org/apache/gluten/execution/GlutenFunctionValidateSuite.scala index 0b91522aedbc..6b4e980851bb 100644 --- a/backends-clickhouse/src/test/scala/org/apache/gluten/execution/GlutenFunctionValidateSuite.scala +++ b/backends-clickhouse/src/test/scala/org/apache/gluten/execution/GlutenFunctionValidateSuite.scala @@ -776,6 +776,13 @@ class GlutenFunctionValidateSuite extends GlutenClickHouseWholeStageTransformerS | cast(id as string)) as timestamp)), | unix_micros(cast(concat('2024-09-03 17:23:10.12345', | cast(id as string)) as timestamp)) + |""".stripMargin + runQueryAndCompare(sql)(checkGlutenOperatorMatch[ProjectExecTransformer]) + } + + test("test function arrays_zip") { + val sql = """ + |SELECT arrays_zip(array(id, id+1, id+2), array(id, id-1, id-2)) |FROM range(10) |""".stripMargin runQueryAndCompare(sql)(checkGlutenOperatorMatch[ProjectExecTransformer]) diff --git a/cpp-ch/local-engine/Parser/scalar_function_parser/CommonScalarFunctionParser.cpp b/cpp-ch/local-engine/Parser/scalar_function_parser/CommonScalarFunctionParser.cpp index f7aea3157c6e..aa66ce229f80 100644 --- a/cpp-ch/local-engine/Parser/scalar_function_parser/CommonScalarFunctionParser.cpp +++ b/cpp-ch/local-engine/Parser/scalar_function_parser/CommonScalarFunctionParser.cpp @@ -166,6 +166,7 @@ REGISTER_COMMON_SCALAR_FUNCTION_PARSER(Shuffle, shuffle, arrayShuffle); REGISTER_COMMON_SCALAR_FUNCTION_PARSER(Range, range, range); REGISTER_COMMON_SCALAR_FUNCTION_PARSER(Flatten, flatten, sparkArrayFlatten); REGISTER_COMMON_SCALAR_FUNCTION_PARSER(ArrayJoin, array_join, sparkArrayJoin); +REGISTER_COMMON_SCALAR_FUNCTION_PARSER(ArrayZip, array_zip, arrayZipUnaligned); // map functions REGISTER_COMMON_SCALAR_FUNCTION_PARSER(Map, map, map);