diff --git a/src/graph/validator/GoValidator.cpp b/src/graph/validator/GoValidator.cpp index cb2ebf62cd1..065db1ab2f8 100644 --- a/src/graph/validator/GoValidator.cpp +++ b/src/graph/validator/GoValidator.cpp @@ -188,8 +188,8 @@ Status GoValidator::extractTagIds() { return Status::OK(); } -void GoValidator::extractPropExprs(const Expression* expr, - std::unordered_set<std::string>& uniqueExpr) { +Status GoValidator::extractPropExprs(const Expression* expr, + std::unordered_set<std::string>& uniqueExpr) { ExtractPropExprVisitor visitor(vctx_, goCtx_->srcEdgePropsExpr, goCtx_->dstPropsExpr, @@ -197,6 +197,7 @@ void GoValidator::extractPropExprs(const Expression* expr, propExprColMap_, uniqueExpr); const_cast<Expression*>(expr)->accept(&visitor); + return std::move(visitor).status(); } Expression* GoValidator::rewriteVertexEdge2EdgeProp(const Expression* expr) { @@ -277,13 +278,13 @@ Status GoValidator::buildColumns() { std::unordered_set<std::string> uniqueEdgeVertexExpr; auto filter = goCtx_->filter; if (filter != nullptr) { - extractPropExprs(filter, uniqueEdgeVertexExpr); + NG_RETURN_IF_ERROR(extractPropExprs(filter, uniqueEdgeVertexExpr)); goCtx_->filter = rewrite2VarProp(filter); } auto* newYieldExpr = pool->makeAndAdd<YieldColumns>(); for (auto* col : goCtx_->yieldExpr->columns()) { - extractPropExprs(col->expr(), uniqueEdgeVertexExpr); + NG_RETURN_IF_ERROR(extractPropExprs(col->expr(), uniqueEdgeVertexExpr)); newYieldExpr->addColumn(new YieldColumn(rewrite2VarProp(col->expr()), col->alias())); } diff --git a/src/graph/validator/GoValidator.h b/src/graph/validator/GoValidator.h index 8299c74b569..0f5293f7021 100644 --- a/src/graph/validator/GoValidator.h +++ b/src/graph/validator/GoValidator.h @@ -36,7 +36,7 @@ class GoValidator final : public Validator { Status extractTagIds(); - void extractPropExprs(const Expression* expr, std::unordered_set<std::string>& uniqueCols); + Status extractPropExprs(const Expression* expr, std::unordered_set<std::string>& uniqueCols); Expression* rewrite2VarProp(const Expression* expr); diff --git a/src/graph/visitor/ExtractPropExprVisitor.cpp b/src/graph/visitor/ExtractPropExprVisitor.cpp index 61e79c11c61..fa2dd1db8b8 100644 --- a/src/graph/visitor/ExtractPropExprVisitor.cpp +++ b/src/graph/visitor/ExtractPropExprVisitor.cpp @@ -47,10 +47,6 @@ void ExtractPropExprVisitor::visit(VariableExpression* expr) { UNUSED(expr); } -void ExtractPropExprVisitor::visit(SubscriptExpression* expr) { - reportError(expr); -} - void ExtractPropExprVisitor::visit(LabelExpression* expr) { reportError(expr); } diff --git a/src/graph/visitor/ExtractPropExprVisitor.h b/src/graph/visitor/ExtractPropExprVisitor.h index 87095bd8db6..470d403d4d0 100644 --- a/src/graph/visitor/ExtractPropExprVisitor.h +++ b/src/graph/visitor/ExtractPropExprVisitor.h @@ -59,8 +59,6 @@ class ExtractPropExprVisitor final : public ExprVisitorImpl { // vertex/edge expression void visit(VertexExpression *) override; void visit(EdgeExpression *) override; - // binary expression - void visit(SubscriptExpression *) override; // column expression void visit(ColumnExpression *) override; diff --git a/tests/tck/features/go/GO.feature b/tests/tck/features/go/GO.feature index 911d9f4b4cc..9948f3eb869 100644 --- a/tests/tck/features/go/GO.feature +++ b/tests/tck/features/go/GO.feature @@ -576,6 +576,37 @@ Feature: Go Sentence | "Chris Paul" | "Carmelo Anthony" | "Dwyane Wade" | | "Chris Paul" | "Dwyane Wade" | "LeBron James" | | "Chris Paul" | "Dwyane Wade" | "Carmelo Anthony" | + When executing query: + """ + GO 3 STEPS FROM "Tim Duncan" OVER like,serve + WHERE (serve.start_year>2000 OR like.likeness>90) AND size(labels($$)[0]) > 0 AND $$.player.age>40 + yield $$ as v + """ + Then the result should be, in any order, with relax comparison: + | v | + | ("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"}) | + When executing query: + """ + GO 3 STEPS FROM "Tim Duncan" OVER like,serve + WHERE size(labels($$))>0 AND $$.player.age>40 + yield $$ as v + """ + Then the result should be, in any order, with relax comparison: + | v | + | ("Tim Duncan" :bachelor{name: "Tim Duncan", speciality: "psychology"} :player{age: 42, name: "Tim Duncan"}) | + | ("Tim Duncan" :bachelor{name: "Tim Duncan", speciality: "psychology"} :player{age: 42, name: "Tim Duncan"}) | + | ("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"}) | + When executing query: + """ + GO 3 STEPS FROM "Tim Duncan" OVER like,serve + WHERE $$.player.age>40 AND size(labels($$)[0]) > 0 + yield $$ as v + """ + Then the result should be, in any order, with relax comparison: + | v | + | ("Tim Duncan" :player{age: 42, name: "Tim Duncan"} :bachelor{name: "Tim Duncan", speciality: "psychology"}) | + | ("Tim Duncan" :player{age: 42, name: "Tim Duncan"} :bachelor{name: "Tim Duncan", speciality: "psychology"}) | + | ("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"}) | @skip Scenario: all prop(reason = $-.* over * $var.* not implement)