Skip to content

Commit

Permalink
[VL] Add Spark array_sort support
Browse files Browse the repository at this point in the history
  • Loading branch information
boneanxs committed Jan 14, 2025
1 parent 5755368 commit 0294890
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ class VeloxSparkPlanExecApi extends SparkPlanExecApi {
}
}

override def genArraySortTransformer(substraitExprName: String, argument: ExpressionTransformer, function: ExpressionTransformer, expr: ArraySort): ExpressionTransformer = {
GenericExpressionTransformer(substraitExprName, Seq(argument, function), expr)
}

/** Transform array exists to Substrait */
override def genArrayExistsTransformer(
substraitExprName: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1166,6 +1166,18 @@ class MiscOperatorSuite extends VeloxWholeStageTransformerSuite with AdaptiveSpa
}
}

test("array_sort") {
withTable("t") {
sql("create table t (a array<string>) using parquet")
sql("insert into t values (array('a', 'acds', 'bcedf', 'dc'))")
runQueryAndCompare(
"select array_sort(a, (x, y) -> " +
"if(length(x) > length(y), 1, if(length(x) < length(y), -1, 0))) from t") {
checkGlutenOperatorMatch[ProjectExecTransformer]
}
}
}

test("Support bool type filter in scan") {
withTable("t") {
sql("create table t (id int, b boolean) using parquet")
Expand Down
4 changes: 2 additions & 2 deletions ep/build-velox/src/get_velox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

set -exu

VELOX_REPO=https://github.com/oap-project/velox.git
VELOX_BRANCH=2025_01_14
VELOX_REPO=https://github.com/boneanxs/velox.git
VELOX_BRANCH=array_sort
VELOX_HOME=""

OS=`uname -s`
Expand Down

0 comments on commit 0294890

Please sign in to comment.