Skip to content

Commit

Permalink
Fix/find start error (#4771)
Browse files Browse the repository at this point in the history
* Fix find start error.

* Fix test.

Co-authored-by: Sophie <[email protected]>
  • Loading branch information
Shylock-Hg and Sophie-Xie committed Oct 24, 2022
1 parent e4d4cac commit 3a454be
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/graph/planner/match/ArgumentFinder.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ class ArgumentFinder final : public StartVidFinder {

StatusOr<SubPlan> transformEdge(EdgeContext* edgeCtx) override;

const char* name() const override {
return "ArgumentFinder";
}

private:
ArgumentFinder() = default;
};
Expand Down
2 changes: 1 addition & 1 deletion src/graph/planner/match/LabelIndexSeek.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ StatusOr<SubPlan> LabelIndexSeek::transformNode(NodeContext* nodeCtx) {

if (filter->kind() == Expression::Kind::kLogicalOr) {
auto exprs = ExpressionUtils::collectAll(filter, {Expression::Kind::kLabelTagProperty});
bool matched = true;
bool matched = exprs.empty() ? false : true;
for (auto* expr : exprs) {
auto tagPropExpr = static_cast<const LabelTagPropertyExpression*>(expr);
if (static_cast<const PropertyExpression*>(tagPropExpr->label())->prop() != nodeAlias ||
Expand Down
4 changes: 4 additions & 0 deletions src/graph/planner/match/LabelIndexSeek.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ class LabelIndexSeek final : public StartVidFinder {
return std::unique_ptr<LabelIndexSeek>(new LabelIndexSeek());
}

const char* name() const override {
return "LabelIndexSeekFinder";
}

private:
LabelIndexSeek() = default;

Expand Down
4 changes: 4 additions & 0 deletions src/graph/planner/match/PropIndexSeek.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ class PropIndexSeek final : public StartVidFinder {

StatusOr<SubPlan> transformEdge(EdgeContext* edgeCtx) override;

const char* name() const override {
return "PropIndexSeekFinder";
}

private:
PropIndexSeek() = default;
};
Expand Down
4 changes: 4 additions & 0 deletions src/graph/planner/match/ScanSeek.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ class ScanSeek final : public StartVidFinder {

StatusOr<SubPlan> transformEdge(EdgeContext* edgeCtx) override;

const char* name() const override {
return "ScanSeekFinder";
}

private:
ScanSeek() = default;
};
Expand Down
2 changes: 2 additions & 0 deletions src/graph/planner/match/StartVidFinder.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ class StartVidFinder {

virtual StatusOr<SubPlan> transformEdge(EdgeContext* edgeCtx) = 0;

virtual const char* name() const = 0;

protected:
StartVidFinder() = default;
};
Expand Down
4 changes: 4 additions & 0 deletions src/graph/planner/match/VertexIdSeek.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ class VertexIdSeek final : public StartVidFinder {

std::string listToAnnoVarVid(QueryContext* qctx, const List& list);

const char* name() const override {
return "VertexIdSeekFinder";
}

private:
VertexIdSeek() = default;
};
Expand Down
16 changes: 16 additions & 0 deletions tests/tck/features/bugfix/FindStartError.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright (c) 2022 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License.
Feature: Test find start error for property index seek

Background:
Given a graph with space named "nba"

# #4763
Scenario: Find start of match pattern
When executing query:
"""
WITH 1 as a MATCH (v:player) WHERE a == 3 OR (a + 1) == 4 RETURN v.player.name;
"""
Then the result should be, in any order:
| v.player.name |

0 comments on commit 3a454be

Please sign in to comment.