Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed bug for index scan when index column is not nullable. #3012

Merged
merged 2 commits into from
Oct 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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