Skip to content

Commit

Permalink
fixed bug for index scan when index column is not nullable. (#3012)
Browse files Browse the repository at this point in the history
* fixed nullable error

* tck fmt
  • Loading branch information
bright-starry-sky authored and Sophie-Xie committed Oct 12, 2021
1 parent be21aee commit 394bd78
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/storage/index/LookupBaseProcessor-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ StatusOr<StoragePlan<IndexID>> LookupBaseProcessor<REQ, RESP>::buildPlan(
auto fields = indexItem->get_fields();

for (const auto& col : fields) {
if (!hasNullableCol && col.get_nullable()) {
if (!hasNullableCol && col.nullable_ref().value_or(false)) {
hasNullableCol = true;
break;
}
Expand Down
23 changes: 18 additions & 5 deletions tests/tck/features/insert/Insert.feature
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,8 @@ Feature: Insert string vid of vertex and edge
"""
CREATE TAG student(name string NOT NULL, age int);
CREATE TAG course(name fixed_string(5) NOT NULL, introduce string DEFAULT NULL);
CREATE TAG INDEX student_i ON student(name(30), age);
CREATE TAG INDEX course_i ON course(name, introduce(30));
"""
# test insert with fixed_string
When try to execute query:
Expand All @@ -491,11 +493,6 @@ Feature: Insert string vid of vertex and edge
INSERT VERTEX student(name, age) VALUES "Tom":(NULL, 12)
"""
Then a ExecutionError should be raised at runtime: Storage Error: The not null field cannot be null.
When executing query:
"""
INSERT VERTEX student(name, age) VALUES "Tom":(NULL, 12)
"""
Then a ExecutionError should be raised at runtime: Storage Error: The not null field cannot be null.
# out of fixed_string's size
When executing query:
"""
Expand All @@ -518,4 +515,20 @@ Feature: Insert string vid of vertex and edge
Then the result should be, in any order:
| VertexID | student.name | student.age |
| '' | 'Tom' | 12 |
# check result
When executing query:
"""
LOOKUP on course YIELD course.name, course.introduce
"""
Then the result should be, in any order:
| VertexID | course.name | course.introduce |
| 'English' | 'Engli' | NULL |
| 'Math' | 'Math' | NULL |
When executing query:
"""
LOOKUP ON student YIELD student.name, student.age
"""
Then the result should be, in any order:
| VertexID | student.name | student.age |
| '' | 'Tom' | 12 |
Then drop the used space

0 comments on commit 394bd78

Please sign in to comment.