diff --git a/src/common/expression/AttributeExpression.cpp b/src/common/expression/AttributeExpression.cpp index 17736004486..026fce2bb0c 100644 --- a/src/common/expression/AttributeExpression.cpp +++ b/src/common/expression/AttributeExpression.cpp @@ -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; } } diff --git a/tests/tck/features/expression/Attribute1.feature b/tests/tck/features/expression/Attribute1.feature new file mode 100644 index 00000000000..91b2e459f62 --- /dev/null +++ b/tests/tck/features/expression/Attribute1.feature @@ -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 |