Skip to content

Commit

Permalink
try fix address error
Browse files Browse the repository at this point in the history
  • Loading branch information
liuneng1994 committed Mar 27, 2024
1 parent 3e7a760 commit a36fb80
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Analyzer/Passes/CaseWhenSimplifyPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ class CaseWhenSimplifyPassVisitor : public InDepthQueryTreeVisitorWithContext<Ca
if (has_else)
{
auto * else_node = case_args.back()->as<ConstantNode>();
if (!else_node)
return;
if (else_node->getValue().isNull())
{
// else node is null, remove it
Expand Down Expand Up @@ -183,6 +185,7 @@ class CaseWhenSimplifyPassVisitor : public InDepthQueryTreeVisitorWithContext<Ca
std::vector<QueryTreeNodePtr> equals_nodes;
for (size_t pos : pos_list)
{
chassert(keys[pos]);
if (keys[pos]->getValue().isNull())
equals_nodes.emplace_back(createFunctionNode(is_null_function_resolver, case_column->clone()));
else
Expand Down Expand Up @@ -246,6 +249,7 @@ class CaseWhenSimplifyPassVisitor : public InDepthQueryTreeVisitorWithContext<Ca
bool column_is_not_null = false;
for (size_t pos : pos_list)
{
chassert(keys[pos]);
if (keys[pos]->getValue().isNull())
{
column_is_not_null = true;
Expand Down Expand Up @@ -299,7 +303,10 @@ class CaseWhenSimplifyPassVisitor : public InDepthQueryTreeVisitorWithContext<Ca
continue;
}
for (size_t pos : pos_list)
{
chassert(keys[pos]);
in_keys.push_back(keys.at(pos)->getValue());
}
}
if (has_not_in)
{
Expand Down Expand Up @@ -366,7 +373,10 @@ class CaseWhenSimplifyPassVisitor : public InDepthQueryTreeVisitorWithContext<Ca
continue;
}
for (size_t pos : pos_list)
{
chassert(keys[pos]);
not_in_keys.push_back(keys.at(pos)->getValue());
}
}
if (has_in)
{
Expand Down

0 comments on commit a36fb80

Please sign in to comment.