Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExpressionVisitor::isConstant failed to check constant CASE_ELSE expression #3386

Open
manh9203 opened this issue Apr 26, 2024 · 0 comments
Open

Comments

@manh9203
Copy link
Collaborator

In ExpressionVisitor::isContant, we are using this code to check if an expression has children or not.

if (expression.getNumChildren() == 0) {
    return expression.expressionType == ExpressionType::LITERAL;
}

It failed to check for constant CASE_ELSE expressions, e.g: CASE WHEN True THEN True ELSE False END, since CASE_ELSE is treated as leaf expression and has no children vector.
I tried to rewrite this part as following

auto children = ExpressionChildrenCollector::collectChildren(expression);
if (children.empty()) {
    return expression.expressionType == ExpressionType::LITERAL;
}

but it caused segfault on recursive join queries with filter, e.g:

MATCH (a:person)-[e:knows*1..2 (r,_ | WHERE list_contains(r.comments, 'rnme'))]->(b:person) WHERE a.fName='Alice' RETURN COUNT(*)

The current work around is to check specifically for CASE_ELSE, but ultimately, using collectChildren should work properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant