Skip to content

Commit

Permalink
[GLUTEN-3489] Fix exception when in-filter contains null value
Browse files Browse the repository at this point in the history
  • Loading branch information
lwz9103 committed Oct 23, 2023
1 parent 04d8ac2 commit 9784cee
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2070,6 +2070,16 @@ class GlutenClickHouseTPCHParquetSuite extends GlutenClickHouseTPCHAbstractSuite
compareResultsAgainstVanillaSpark(sql, true, { _ => })
}

test("test in-filter contains null value (bigint)") {
val sql = "select s_nationkey from supplier where s_nationkey in (null, 1, 2)"
compareResultsAgainstVanillaSpark(sql, true, { _ => })
}

test("test in-filter contains null value (string)") {
val sql = "select n_name from nation where n_name in ('CANADA', null, 'BRAZIL')"
compareResultsAgainstVanillaSpark(sql, true, { _ => })
}

test("GLUTEN-3287: diff when divide zero") {
withSQLConf(
SQLConf.OPTIMIZER_EXCLUDED_RULES.key -> (ConstantFolding.ruleName + "," + NullPropagation.ruleName)) {
Expand Down
1 change: 1 addition & 0 deletions cpp-ch/local-engine/Parser/SerializedPlanParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1839,6 +1839,7 @@ const ActionsDAG::Node * SerializedPlanParser::parseExpression(ActionsDAGPtr act
DB::ActionsDAG::NodeRawConstPtrs cast_args({function_node, add_column(type, true), add_column(type, Field())});
auto cast = FunctionFactory::instance().get("if", context);
function_node = toFunctionNode(actions_dag, "if", cast_args);
actions_dag->addOrReplaceInOutputs(*function_node);
}
return function_node;
}
Expand Down

0 comments on commit 9784cee

Please sign in to comment.