Skip to content

Commit 9e2ec55

Browse files
authored
[VL] Enable arrays_zip function (#5609)
[VL] Enable arrays_zip function.
1 parent 8efe3e4 commit 9e2ec55

File tree

6 files changed

+24
-2
lines changed

6 files changed

+24
-2
lines changed

backends-clickhouse/src/main/scala/org/apache/gluten/utils/CHExpressionUtil.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ object CHExpressionUtil {
175175
ARRAY_EXCEPT -> DefaultValidator(),
176176
ARRAY_REPEAT -> DefaultValidator(),
177177
ARRAY_REMOVE -> DefaultValidator(),
178+
ARRAYS_ZIP -> DefaultValidator(),
178179
DATE_FROM_UNIX_DATE -> DefaultValidator(),
179180
UNIX_DATE -> DefaultValidator(),
180181
MONOTONICALLY_INCREASING_ID -> DefaultValidator(),

backends-velox/src/test/scala/org/apache/gluten/execution/ScalarFunctionsValidateSuite.scala

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,24 @@ class ScalarFunctionsValidateSuite extends FunctionsValidateTest {
820820
}
821821
}
822822

823+
test("arrays_zip") {
824+
withTempPath {
825+
path =>
826+
Seq[(Seq[Integer], Seq[Integer])](
827+
(Seq(1, 2, 3), Seq(3, 4)),
828+
(Seq(5, null), Seq(null, 1, 2)))
829+
.toDF("v1", "v2")
830+
.write
831+
.parquet(path.getCanonicalPath)
832+
833+
spark.read.parquet(path.getCanonicalPath).createOrReplaceTempView("array_tbl")
834+
835+
runQueryAndCompare("select arrays_zip(v1, v2) from array_tbl;") {
836+
checkGlutenOperatorMatch[ProjectExecTransformer]
837+
}
838+
}
839+
}
840+
823841
test("negative") {
824842
runQueryAndCompare("select negative(l_orderkey) from lineitem") {
825843
checkGlutenOperatorMatch[ProjectExecTransformer]

cpp/velox/substrait/SubstraitParser.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,8 @@ std::unordered_map<std::string, std::string> SubstraitParser::substraitVeloxFunc
406406
{"try_add", "plus"},
407407
{"forall", "all_match"},
408408
{"exists", "any_match"},
409-
{"negative", "unaryminus"}};
409+
{"negative", "unaryminus"},
410+
{"arrays_zip", "zip"}};
410411

411412
const std::unordered_map<std::string, std::string> SubstraitParser::typeMap_ = {
412413
{"bool", "BOOLEAN"},

docs/velox-backend-support-progress.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ Gluten supports 199 functions. (Drag to right to see all data types)
273273
| array_sort | array_sort | array_sort | S | | | | | | | | | | | | | | | | | | | |
274274
| array_union | | | | | | | | | | | | | | | | | | | | | | |
275275
| arrays_overlap | array_overlap | | | | | | | | | | | | | | | | | | | | | |
276-
| arrays_zip | | | | | | | | | | | | | | | | | | | | | | |
276+
| arrays_zip | zip | | S | | | | | | | | | | | | | | | | | | | |
277277
| cardinality | cardinality | | | | | | | | | | | | | | | | | | | | | |
278278
| element_at | element_at | element_at | S | | | | | | | | | | | | | | | | S | S | | |
279279
| exists | any_match | | S | | | | | | | | | | | | | | | | | | | |

gluten-core/src/main/scala/org/apache/gluten/expression/ExpressionMappings.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ object ExpressionMappings {
234234
Sig[ArrayExcept](ARRAY_EXCEPT),
235235
Sig[ArrayRepeat](ARRAY_REPEAT),
236236
Sig[ArrayRemove](ARRAY_REMOVE),
237+
Sig[ArraysZip](ARRAYS_ZIP),
237238
Sig[ArrayFilter](FILTER),
238239
Sig[ArrayForAll](FORALL),
239240
Sig[ArrayExists](EXISTS),

shims/common/src/main/scala/org/apache/gluten/expression/ExpressionNames.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ object ExpressionNames {
250250
final val ARRAY_EXCEPT = "array_except"
251251
final val ARRAY_REPEAT = "array_repeat"
252252
final val ARRAY_REMOVE = "array_remove"
253+
final val ARRAYS_ZIP = "arrays_zip"
253254
final val FILTER = "filter"
254255
final val FORALL = "forall"
255256
final val EXISTS = "exists"

0 commit comments

Comments
 (0)