diff --git a/src/common/expression/AttributeExpression.cpp b/src/common/expression/AttributeExpression.cpp index 66d166ce844..92425be7892 100644 --- a/src/common/expression/AttributeExpression.cpp +++ b/src/common/expression/AttributeExpression.cpp @@ -51,7 +51,7 @@ const Value &AttributeExpression::eval(ExpressionContext &ctx) { } auto iter = lvalue.getEdge().props.find(rvalue.getStr()); if (iter == lvalue.getEdge().props.end()) { - return Value::kNullUnknownProp; + return Value::kNullValue; } return iter->second; } diff --git a/tests/tck/features/expression/Attribute.feature b/tests/tck/features/expression/Attribute.feature index 9ea378b41e5..c471c3554c4 100644 --- a/tests/tck/features/expression/Attribute.feature +++ b/tests/tck/features/expression/Attribute.feature @@ -90,9 +90,9 @@ Feature: Attribute MATCH (v)-[e:like]->() WHERE id(v) == 'Tim Duncan' RETURN e.Likeness """ Then the result should be, in any order: - | e.Likeness | - | UNKNOWN_PROP | - | UNKNOWN_PROP | + | e.Likeness | + | NULL | + | NULL | Scenario: Not exists attribute When executing query: @@ -136,8 +136,8 @@ Feature: Attribute """ Then the result should be, in any order: | e.not_exists_attr | - | UNKNOWN_PROP | - | UNKNOWN_PROP | + | NULL | + | NULL | Scenario: Invalid type When executing query: diff --git a/tests/tck/features/match/With.feature b/tests/tck/features/match/With.feature index d4cdca681c0..8cf68f1edd1 100644 --- a/tests/tck/features/match/With.feature +++ b/tests/tck/features/match/With.feature @@ -320,3 +320,57 @@ Feature: With clause RETURN a """ Then a SemanticError should be raised at runtime: Alias `b` not defined + + Scenario: condition on nonexist prop + Given an empty graph + And having executed: + """ + CREATE SPACE IF NOT EXISTS `nebula_huskie` (partition_num = 32, replica_factor = 1, charset = utf8, collate = utf8_bin, vid_type = INT64, atomic_edge = false); + """ + And having executed: + """ + USE `nebula_huskie` + """ + And having executed: + """ + CREATE EDGE IF NOT EXISTS `EDGE_0` (`edgeProp_0_0` bool NULL, `edgeProp_0_1` bool NULL, `edgeProp_0_2` float NULL, + `edgeProp_0_3` string NULL, `edgeProp_0_4` float NULL) + ttl_duration = 0, ttl_col = "" + """ + And having executed: + """ + CREATE EDGE IF NOT EXISTS `EDGE_1` (`edgeProp_1_0` bool NULL) ttl_duration = 0, ttl_col = "" + """ + And having executed: + """ + CREATE TAG IF NOT EXISTS `Label_0` (`labelProp_0_0` float NULL, `labelProp_0_1` string NULL, `labelProp_0_2` bool NULL, `labelProp_0_3` string NULL) ttl_duration = 0, ttl_col = "" + """ + And wait 3 seconds + And having executed: + """ + insert vertex Label_0(labelProp_0_0, labelProp_0_1, labelProp_0_2, labelProp_0_3) values 100:(0.5402889847755432,"Rajon Rondo",true,"Shaquile O'Neal"); + insert vertex Label_0(labelProp_0_0, labelProp_0_1, labelProp_0_2, labelProp_0_3) values 101:(0.5402889847755432,"Rajon Rondo",true,"Shaquile O'Neal"); + insert edge EDGE_0 values 100->101:(true, false, 0.9068049788475037, "Yao Ming", 0.906804); + insert edge EDGE_1 values 100->101:(true); + """ + When executing query: + """ + Match p = (v)-[e]->(t) where id(v) in [100] and e.edgeProp_1_0 == true with e as e, t as t where e.edgeProp_1_0 == true return e; + """ + Then the result should be, in any order: + | e | + | [:EDGE_1 100->101 @0 {edgeProp_1_0: true}] | + When executing query: + """ + match p = (v)-[e]->(t) where id(v) in [100] and e.edgeProp_0_0 == true with e as e, t as t where e.edgeProp_0_0 == true return e.edgeProp_0_0; + """ + Then the result should be, in any order: + | e.edgeProp_0_0 | + | true | + When executing query: + """ + match p = (v)-[e]->(t) where id(v) in [100] and e.edgeProp_0_0 == true with e as e, t as t where e.edgeProp_0_0 == true return e.edgeProp_1_0; + """ + Then the result should be, in any order: + | e.edgeProp_1_0 | + | NULL | diff --git a/tests/tck/features/optimizer/PrunePropertiesRule.feature b/tests/tck/features/optimizer/PrunePropertiesRule.feature index 95e34b8f812..b85e1581152 100644 --- a/tests/tck/features/optimizer/PrunePropertiesRule.feature +++ b/tests/tck/features/optimizer/PrunePropertiesRule.feature @@ -845,10 +845,10 @@ Feature: Prune Properties rule match (src_v)-[e:like|serve]->(dst_v)-[e2]-(dst_v2) where id(src_v)=="Rajon Rondo" return properties(e).degree1,properties(e).degree1,e2.a,dst_v.p.name,dst_v.player.sex1,properties(src_v).name2 limit 5; """ Then the result should be, in order, with relax comparison: - | properties(e).degree1 | properties(e).degree1 | e2.a | dst_v.p.name | dst_v.player.sex1 | properties(src_v).name2 | - | UNKNOWN_PROP | UNKNOWN_PROP | UNKNOWN_PROP | NULL | NULL | UNKNOWN_PROP | - | UNKNOWN_PROP | UNKNOWN_PROP | UNKNOWN_PROP | NULL | NULL | UNKNOWN_PROP | - | UNKNOWN_PROP | UNKNOWN_PROP | UNKNOWN_PROP | NULL | NULL | UNKNOWN_PROP | - | UNKNOWN_PROP | UNKNOWN_PROP | UNKNOWN_PROP | NULL | NULL | UNKNOWN_PROP | - | UNKNOWN_PROP | UNKNOWN_PROP | UNKNOWN_PROP | NULL | NULL | UNKNOWN_PROP | + | properties(e).degree1 | properties(e).degree1 | e2.a | dst_v.p.name | dst_v.player.sex1 | properties(src_v).name2 | + | UNKNOWN_PROP | UNKNOWN_PROP | NULL | NULL | NULL | UNKNOWN_PROP | + | UNKNOWN_PROP | UNKNOWN_PROP | NULL | NULL | NULL | UNKNOWN_PROP | + | UNKNOWN_PROP | UNKNOWN_PROP | NULL | NULL | NULL | UNKNOWN_PROP | + | UNKNOWN_PROP | UNKNOWN_PROP | NULL | NULL | NULL | UNKNOWN_PROP | + | UNKNOWN_PROP | UNKNOWN_PROP | NULL | NULL | NULL | UNKNOWN_PROP | Then drop the used space