Skip to content

Commit

Permalink
fix parameter expression in lookup statement (#4664)
Browse files Browse the repository at this point in the history
* fix parameter expression in lookup statement

small change

small fix

fix tckl

* fix tck fmt

Co-authored-by: Sophie <[email protected]>
  • Loading branch information
czpmango and Sophie-Xie authored Sep 21, 2022
1 parent 545137a commit 7b72b14
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/graph/validator/LookupValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +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);
auto v = Expression::eval(expr, dummy);
auto v = Expression::eval(expr, QueryExpressionContext(qctx_->ectx())());
// 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" |
| "Shaquille 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 7b72b14

Please sign in to comment.