Skip to content

Commit

Permalink
support function array_except
Browse files Browse the repository at this point in the history
  • Loading branch information
taiyang-li committed Aug 27, 2024
1 parent f405cd1 commit dce7461
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ object CHExpressionUtil {
DATE_FORMAT -> DateFormatClassValidator(),
DECODE -> EncodeDecodeValidator(),
ENCODE -> EncodeDecodeValidator(),
ARRAY_EXCEPT -> DefaultValidator(),
ARRAY_REPEAT -> DefaultValidator(),
ARRAY_REMOVE -> DefaultValidator(),
ARRAYS_ZIP -> DefaultValidator(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -755,4 +755,12 @@ class GlutenFunctionValidateSuite extends GlutenClickHouseWholeStageTransformerS
|""".stripMargin
runQueryAndCompare(sql)(checkGlutenOperatorMatch[ProjectExecTransformer])
}

test("test function array_except") {
val sql = """
|SELECT array_except(array(id, id+1, id+2), array(id+2, id+3))
|FROM RANGE(10)
|""".stripMargin
runQueryAndCompare(sql)(checkGlutenOperatorMatch[ProjectExecTransformer])
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class FunctionParserArrayExcept : public FunctionParser
// Create lambda function x -> !has(arr2, x)
ActionsDAG lambda_actions_dag;
const auto * arr2_in_lambda = &lambda_actions_dag.addInput(arr2_arg->result_name, arr2_arg->result_type);
const auto & nested_type = assert_cast<DataTypeArray &>(removeNullable(arr1_arg->result_type)).getNestedType();
const auto & nested_type = assert_cast<const DataTypeArray &>(*removeNullable(arr1_arg->result_type)).getNestedType();
const auto * x_in_lambda = &lambda_actions_dag.addInput("x", nested_type);
const auto * has_in_lambda = toFunctionNode(lambda_actions_dag, "has", {arr2_in_lambda, x_in_lambda});
const auto * lambda_output = toFunctionNode(lambda_actions_dag, "not", {has_in_lambda});
Expand Down

0 comments on commit dce7461

Please sign in to comment.