Skip to content
This repository has been archived by the owner on Dec 1, 2022. It is now read-only.

Commit

Permalink
Fix seek by negative vid (#932)
Browse files Browse the repository at this point in the history
* Fix seek by negtive vid

Fix typo

* Fix tck
  • Loading branch information
Aiee authored Apr 8, 2021
1 parent 669252a commit e70c326
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/validator/MatchValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ Status MatchValidator::validateStepRange(const MatchStepRange *range) const {
}
if (min < 0) {
return Status::SemanticError(
"Cannot set negtive steps minumum hop for variable length relationships");
"Cannot set negative steps minumum hop for variable length relationships");
}
return Status::OK();
}
Expand Down
3 changes: 3 additions & 0 deletions src/visitor/FoldConstantExprVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ void FoldConstantExprVisitor::visit(UnaryExpression *expr) {
if (canBeFolded_) {
expr->setOperand(fold(expr->operand()));
}
} else {
canBeFolded_ = expr->kind() == Expression::Kind::kUnaryNegate ||
expr->kind() == Expression::Kind::kUnaryPlus;
}
}

Expand Down
43 changes: 43 additions & 0 deletions tests/tck/features/match/SeekById.intVid.feature
Original file line number Diff line number Diff line change
Expand Up @@ -264,3 +264,46 @@ Feature: Match seek by id
| 'Aron Baynes' |
| 'Blake Griffin' |
| 'Grant Hill' |

Scenario: [v2ga bug] Negative start vid
Given an empty graph
And create a space with following options:
| partition_num | 9 |
| replica_factor | 1 |
| vid_type | int64 |
| charset | utf8 |
| collate | utf8_bin |
And having executed:
"""
CREATE TAG player(name string, age int);
"""
When try to execute query:
"""
INSERT VERTEX player(name, age) VALUES -100:("Tim", 32);
"""
Then the execution should be successful
When executing query:
"""
CREATE TAG INDEX player_name_index ON player(name(10));
"""
Then the execution should be successful
And wait 6 seconds
When submit a job:
"""
REBUILD TAG INDEX player_name_index;
"""
Then wait the job to finish
When executing query:
"""
MATCH (v) WHERE id(v) == -100 RETURN v;
"""
Then the result should be, in any order:
| v |
| (-100 :player{age: 32, name: "Tim"}) |
When executing query:
"""
MATCH (v) WHERE id(v) IN [-100] RETURN v;
"""
Then the result should be, in any order:
| v |
| (-100 :player{age: 32, name: "Tim"}) |

0 comments on commit e70c326

Please sign in to comment.