Skip to content

Commit

Permalink
support intersect/minus for cypher
Browse files Browse the repository at this point in the history
  • Loading branch information
jievince committed Dec 28, 2022
1 parent 7a7470a commit fbd0fca
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/graph/context/ast/CypherAstContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ struct YieldClauseContext final : CypherClauseContextBase {
std::vector<Path> paths;

bool distinct{false};
const YieldColumns* yieldColumns{nullptr};
YieldColumns* yieldColumns{nullptr};

bool hasAgg_{false};
bool needGenProject_{false};
Expand Down
6 changes: 5 additions & 1 deletion src/graph/validator/MatchValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1063,13 +1063,17 @@ Status MatchValidator::checkAlias(

// Validate yield columns.
// Fill outputs of whole sentence.
Status MatchValidator::buildOutputs(const YieldColumns *yields) {
Status MatchValidator::buildOutputs(YieldColumns *yields) {
for (auto *col : yields->columns()) {
auto colName = col->name();
auto typeStatus = deduceExprType(col->expr());
NG_RETURN_IF_ERROR(typeStatus);
auto type = typeStatus.value();
outputs_.emplace_back(colName, type);

auto foldStatus = ExpressionUtils::foldConstantExpr(col->expr());
NG_RETURN_IF_ERROR(foldStatus);
col->setExpr(foldStatus.value());
}
return Status::OK();
}
Expand Down
2 changes: 1 addition & 1 deletion src/graph/validator/MatchValidator.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class MatchValidator final : public Validator {
Status checkAlias(const Expression *refExpr,
const std::unordered_map<std::string, AliasType> &aliasesAvailable) const;

Status buildOutputs(const YieldColumns *yields);
Status buildOutputs(YieldColumns *yields);

StatusOr<Expression *> makeEdgeSubFilter(MapExpression *map) const;

Expand Down
2 changes: 1 addition & 1 deletion tests/tck/features/expression/Case.feature
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ Feature: Case Expression
Scenario: Using the return value of case expr as an input
When executing query:
"""
RETURN CASE WHEN true THEN "Tim Duncan" ELSE "ABC" END AS a | GO FROM $-.a OVER like YIELD like._dst;
YIELD CASE WHEN true THEN "Tim Duncan" ELSE "ABC" END AS a | GO FROM $-.a OVER like YIELD like._dst;
"""
Then the result should be, in order:
| like._dst |
Expand Down
3 changes: 3 additions & 0 deletions tests/tck/features/expression/function/Mathematical.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
# This source code is licensed under Apache 2.0 License.
Feature: Mathematical function Expression

Background:
Given a graph with space named "nba"

Scenario: bit functions
When executing query:
"""
Expand Down
5 changes: 4 additions & 1 deletion tests/tck/features/function/coalesce.feature
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# Copyright (c) 2022 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License.
Feature: Coalesce Function

Background:
Test coalesce function
Given a graph with space named "nba"

Scenario: test normal case
When executing query:
Expand Down
4 changes: 2 additions & 2 deletions tests/tck/features/yield/return.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Feature: Return

Background:
Given an empty graph
Given a graph with space named "nba"

Scenario: base
When executing query:
Expand Down Expand Up @@ -79,4 +79,4 @@ Feature: Return
"""
RETURN name
"""
Then a SemanticError should be raised at runtime: Invalid label identifiers: name
Then a SemanticError should be raised at runtime: Alias used but not defined: `name'

0 comments on commit fbd0fca

Please sign in to comment.