Skip to content

fix: SIGSEGV when path variable referenced inside a list-lambda#621

Merged
adsharma merged 1 commit into
mainfrom
ladybug-619
Jun 25, 2026
Merged

fix: SIGSEGV when path variable referenced inside a list-lambda#621
adsharma merged 1 commit into
mainfrom
ladybug-619

Conversation

@adsharma

Copy link
Copy Markdown
Contributor

Fixes: #619

The ProjectionPushDownOptimizer::collectExpressionsInUse did not handle
LambdaExpression. A LambdaExpression stores its body (functionExpr) separately
from its regular expression children, so the default case -- which uses
ExpressionChildrenCollector::collectChildren -- never traversed into the
lambda body. As a result, expressions referenced only inside a list-lambda
(e.g. any(x IN [...] WHERE p IS NOT NULL)) were not marked "in use".

When the lambda body references a path variable p assembled from multiple
recursive-rel segments (MATCH p = (a)-[*1..2]-(b)-[*1..2]-(c)), the recursive
rel segments weren't kept in scope by the projection push-down optimizer.
The first recursive rel's vector got pruned from the schema feeding the
lambda's expression mapper.

Later, when ExpressionMapper::getPathEvaluator mapped the path's children
inside the lambda body, the pruned RECURSIVE_REL children were not in scope,
were not matched by isNodePattern/isRelPattern (which only cover NODE/REL),
and -- because parentEvaluator != nullptr inside a lambda -- fell through to
getLambdaParamEvaluator. ListLambdaEvaluator::init then replaced those
evaluators' resultVectors with the data vector of the list input (an INT64
vector with no StructAuxiliaryBuffer). PathExpressionEvaluator::init called
StructVector::getFieldVector on that non-struct vector and dereferenced a
null struct auxiliary buffer -> SIGSEGV.

Fix: add an explicit LAMBDA case to collectExpressionsInUse that recursively
collects the lambda's functionExpr, so path segments referenced inside a
lambda body are kept materialized.

Verified: the repro queries any/all/none/single/list_transform/list_reduce
over MATCH p = (a)-[*1..2]-(b)-[*1..2]-(c) no longer crash and return correct
results; single-segment paths, RETURN p, length(p)/nodes(p)/rels(p) still
work.
@adsharma adsharma force-pushed the ladybug-619 branch 2 times, most recently from 45633d9 to 417e7f8 Compare June 25, 2026 17:52
@adsharma adsharma merged commit 0c19d78 into main Jun 25, 2026
4 checks passed
@adsharma adsharma deleted the ladybug-619 branch June 25, 2026 18:05
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

Successfully merging this pull request may close these issues.

SIGSEGV: PathExpressionEvaluator::init — null struct buffer when a path variable is used inside a list-lambda

1 participant