diff --git a/src/validator/MatchValidator.cpp b/src/validator/MatchValidator.cpp index 32c45e440d9774c10ab115abbef7ff1190d51eb5..80fdb336b401e292b2adeaa729b219089151c0a7 100644 --- a/src/validator/MatchValidator.cpp +++ b/src/validator/MatchValidator.cpp @@ -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(); } diff --git a/src/visitor/FoldConstantExprVisitor.cpp b/src/visitor/FoldConstantExprVisitor.cpp index cb14830a374507421b0a92873b6c96724e5fabb4..bf9c4e2eea8ec897e0fd1e5d53df4c5c3c495ebe 100644 --- a/src/visitor/FoldConstantExprVisitor.cpp +++ b/src/visitor/FoldConstantExprVisitor.cpp @@ -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; } } diff --git a/tests/tck/features/match/SeekById.intVid.feature b/tests/tck/features/match/SeekById.intVid.feature index 8fd2acca3ef6ca6f4d3114dea9e665d1f855db25..f814dbb6f2fd2df6e26812454fc090e5d0c2b7a4 100644 --- a/tests/tck/features/match/SeekById.intVid.feature +++ b/tests/tck/features/match/SeekById.intVid.feature @@ -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"}) |