kuzu
kuzu copied to clipboard
```ExpressionVisitor::isConstant``` failed to check constant ```CASE_ELSE``` expression
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.