Skip to content

Commit

Permalink
deduce props (#5121)
Browse files Browse the repository at this point in the history
  • Loading branch information
xtcyclist authored Dec 27, 2022
1 parent f8935e0 commit c1298dd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/graph/validator/GroupByValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ Status GroupByValidator::validateYield(const YieldClause* yieldClause) {
aggOutputColNames_.emplace_back(agg->toString());
groupItems_.emplace_back(agg->clone());
needGenProject_ = true;
ExpressionProps yieldProps;
NG_RETURN_IF_ERROR(deduceProps(agg, yieldProps));
exprProps_.unionProps(std::move(yieldProps));
}
if (!aggs.empty()) {
auto* colRewrited = ExpressionUtils::rewriteAgg2VarProp(colExpr->clone());
Expand Down
10 changes: 10 additions & 0 deletions tests/tck/features/yield/parameter.feature
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,13 @@ Feature: Parameter
"""
Then a SyntaxError should be raised at runtime: Direct output of variable is prohibited near `$var'
Then clear the used parameters

Scenario: expression with parameters
When executing query:
"""
$var=go from "Tim Duncan" over like yield like._dst as id, like.likeness as likeness;
yield avg($var.likeness)+1 as v;
"""
Then the result should be, in any order:
| v |
| 96.0 |

0 comments on commit c1298dd

Please sign in to comment.