Skip to content

Commit

Permalink
fix parameter expression in lookup statement
Browse files Browse the repository at this point in the history
  • Loading branch information
czpmango committed Sep 20, 2022
1 parent 7d5e93f commit 45a964b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/graph/validator/LookupValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ StatusOr<Expression*> LookupValidator::checkConstExpr(Expression* expr,
if (type == nebula::cpp2::PropertyType::UNKNOWN) {
return Status::SemanticError("Invalid column: %s", prop.c_str());
}
QueryExpressionContext dummy(nullptr);
QueryExpressionContext dummy(qctx_->ectx());
auto v = Expression::eval(expr, dummy);
// TODO(Aiee) extract the type cast logic as a method if we decide to support
// more cross-type comparisons.
Expand Down
13 changes: 13 additions & 0 deletions tests/tck/features/yield/parameter.feature
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,19 @@ Feature: Parameter
| "Tim Duncan" |

Scenario: ngql with parameters
When executing query:
"""
LOOKUP ON player where player.age>$p1+40 YIELD player.name AS name
"""
Then the result should be, in any order:
| name |
| "Grant Hill" |
| "Jason Kidd" |
| "Vince Carter" |
| "Tim Duncan" |
| "Shaquile O'Neal" |
| "Steve Nash" |
| "Ray Allen" |
When executing query:
"""
$p1=GO FROM "Tim Duncan" OVER like WHERE like.likeness>$p1 yield like._dst as dst;
Expand Down

0 comments on commit 45a964b

Please sign in to comment.