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

Fix the crash when lookup parameter expression eval in storage #5336

Merged
merged 3 commits into from
Feb 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/graph/validator/LookupValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ Status LookupValidator::validateWhere() {
}

auto* filter = whereClause->filter();
if (filter != nullptr) {
filter = graph::ExpressionUtils::rewriteParameter(filter, qctx_);
}
if (FTIndexUtils::needTextSearch(filter)) {
lookupCtx_->isFulltextIndex = true;
lookupCtx_->fulltextExpr = filter;
Expand Down
4 changes: 1 addition & 3 deletions src/storage/ExprVisitorBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ void ExprVisitorBase::visit(SubscriptExpression *expr) {
expr->left()->accept(this);
expr->right()->accept(this);
}
void ExprVisitorBase::visit(AttributeExpression *expr) {
fatal(expr);
}
void ExprVisitorBase::visit(AttributeExpression *) {}
void ExprVisitorBase::visit(LogicalExpression *expr) {
for (auto operand : expr->operands()) {
operand->accept(this);
Expand Down
17 changes: 16 additions & 1 deletion tests/tck/features/yield/parameter.feature
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ Feature: Parameter
"""
LOOKUP ON player WHERE player.age>$p2+43
"""
Then a SemanticError should be raised at runtime: Column type error : age
Then a SemanticError should be raised at runtime: Type error `(true+43)'
When executing query:
"""
MATCH (v:player) RETURN v LIMIT $p6
Expand Down Expand Up @@ -388,3 +388,18 @@ Feature: Parameter
update edge on like "1"->"2" set likeness=likeness+$p6.a when likeness>$p1
"""
Then the execution should be successful
When executing query:
"""
$var=lookup on player where player.name==$p6.c and player.age in [43,35,42,45] yield id(vertex) AS VertexID;DELETE VERTEX $var.VertexID;RETURN count($var.VertexID) AS record
"""
Then the execution should be successful
When executing query:
"""
$var=lookup on player where player.name==$p3 and player.age in [43,35,42,45] yield id(vertex) AS VertexID;DELETE VERTEX $var.VertexID;RETURN count($var.VertexID) AS record
"""
Then the execution should be successful
When executing query:
"""
$var=lookup on player where player.name==$p7.a.b.d[4] and player.age in [43,35,42,45] yield id(vertex) AS VertexID;DELETE VERTEX $var.VertexID;RETURN count($var.VertexID) AS record
"""
Then the execution should be successful