Skip to content

Commit 9699556

Browse files
authored
fix(interactive): Fix bug of IS_NULL check for edge property (#4386)
Fix #4384
1 parent c38dd7d commit 9699556

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

flex/engines/graph_db/runtime/adhoc/expr_impl.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,9 @@ RTAny UnaryLogicalExpr::eval_edge(const LabelTriplet& label, vid_t src,
206206
if (logic_ == common::Logical::NOT) {
207207
return RTAny::from_bool(
208208
!expr_->eval_edge(label, src, dst, data, idx).as_bool());
209+
} else if (logic_ == common::Logical::ISNULL) {
210+
return RTAny::from_bool(
211+
expr_->eval_edge(label, src, dst, data, idx, 0).is_null());
209212
}
210213
LOG(FATAL) << "not support" << static_cast<int>(logic_);
211214
return RTAny::from_bool(false);

flex/engines/graph_db/runtime/common/rt_any.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ RTAny::RTAny(const Any& val) {
119119
} else if (val.type == PropertyType::Bool()) {
120120
type_ = RTAnyType::kBoolValue;
121121
value_.b_val = val.AsBool();
122+
} else if (val.type == PropertyType::Empty()) {
123+
type_ = RTAnyType::kNull;
122124
} else {
123125
LOG(FATAL) << "Any value: " << val.to_string()
124126
<< ", type = " << val.type.type_enum;
@@ -355,6 +357,8 @@ std::string_view RTAny::as_string() const {
355357
return value_.str_val;
356358
} else if (type_ == RTAnyType::kUnknown) {
357359
return std::string_view();
360+
} else if (type_ == RTAnyType::kNull) {
361+
return std::string_view();
358362
} else {
359363
LOG(FATAL) << "unexpected type" << static_cast<int>(type_.type_enum_);
360364
return std::string_view();

interactive_engine/compiler/src/main/java/com/alibaba/graphscope/cypher/integration/suite/movie/MovieQueries.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,4 +399,10 @@ public static QueryContext get_movie_query28_test() {
399399
List<String> expected = Arrays.asList("Record<{typeA: \"Person\", typeC: \"Movie\"}>");
400400
return new QueryContext(query, expected);
401401
}
402+
403+
public static QueryContext get_movie_query29_test() {
404+
String query = "MATCH(a)-[r]->(b) where r.rating is null return count(r) as count;";
405+
List<String> expected = Arrays.asList("Record<{count: 249}>");
406+
return new QueryContext(query, expected);
407+
}
402408
}

interactive_engine/compiler/src/test/java/com/alibaba/graphscope/cypher/integration/movie/MovieTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,13 @@ public void run_movie_query28_test() {
218218
Assert.assertEquals(testQuery.getExpectedResult().toString(), result.list().toString());
219219
}
220220

221+
@Test
222+
public void run_movie_query29_test() {
223+
QueryContext testQuery = MovieQueries.get_movie_query29_test();
224+
Result result = session.run(testQuery.getQuery());
225+
Assert.assertEquals(testQuery.getExpectedResult().toString(), result.list().toString());
226+
}
227+
221228
@AfterClass
222229
public static void afterClass() {
223230
if (session != null) {

0 commit comments

Comments
 (0)