Skip to content

Commit

Permalink
return plain null values if tag or prop does not exist. (#5151)
Browse files Browse the repository at this point in the history
  • Loading branch information
xtcyclist committed Dec 30, 2022
1 parent 3bce910 commit 9371098
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/common/expression/AttributeExpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ const Value &AttributeExpression::eval(ExpressionContext &ctx) {
result_ = time::TimeUtils::getDateTimeAttr(lvalue.getDateTime(), rvalue.getStr());
return result_;
default:
if (lvalue.isNull() && lvalue.getNull() == NullType::UNKNOWN_PROP) {
// return UNKNOWN_PROP as plain null values, instead of bad type.
return Value::kNullValue;
}
return Value::kNullBadType;
}
}
Expand Down
33 changes: 33 additions & 0 deletions tests/tck/features/expression/Attribute1.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright (c) 2021 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License.
Feature: Attribute using test

Background:
Given load "test" csv data to a new space

Scenario: Attribute with null data
When executing query:
"""
MATCH p0 = (v0)-[e0]->()
WHERE id(v0) in [1,2,3,4,5,6,7,8,9,10]
UNWIND nodes(p0) AS ua0
with ua0
where ua0.Label_5.Label_5_7_Bool
return count(*)
"""
Then the result should be, in any order:
| count(*) |
| 61 |
When executing query:
"""
MATCH p0 = (v0)-[e0]->()
WHERE id(v0) in [1,2,3,4,5,6,7,8,9,10]
UNWIND nodes(p0) AS ua0
with ua0
where ua0.Label_5.Label_5_7_Bool == true
return count(*)
"""
Then the result should be, in any order:
| count(*) |
| 61 |

0 comments on commit 9371098

Please sign in to comment.