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

fix(interactive): Fix bug of IS_NULL check for edge property #4386

Merged
merged 1 commit into from
Dec 25, 2024
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
3 changes: 3 additions & 0 deletions flex/engines/graph_db/runtime/adhoc/expr_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@ RTAny UnaryLogicalExpr::eval_edge(const LabelTriplet& label, vid_t src,
if (logic_ == common::Logical::NOT) {
return RTAny::from_bool(
!expr_->eval_edge(label, src, dst, data, idx).as_bool());
} else if (logic_ == common::Logical::ISNULL) {
return RTAny::from_bool(
expr_->eval_edge(label, src, dst, data, idx, 0).is_null());
}
LOG(FATAL) << "not support" << static_cast<int>(logic_);
return RTAny::from_bool(false);
Expand Down
4 changes: 4 additions & 0 deletions flex/engines/graph_db/runtime/common/rt_any.cc
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ RTAny::RTAny(const Any& val) {
} else if (val.type == PropertyType::Bool()) {
type_ = RTAnyType::kBoolValue;
value_.b_val = val.AsBool();
} else if (val.type == PropertyType::Empty()) {
type_ = RTAnyType::kNull;
} else {
LOG(FATAL) << "Any value: " << val.to_string()
<< ", type = " << val.type.type_enum;
Expand Down Expand Up @@ -355,6 +357,8 @@ std::string_view RTAny::as_string() const {
return value_.str_val;
} else if (type_ == RTAnyType::kUnknown) {
return std::string_view();
} else if (type_ == RTAnyType::kNull) {
return std::string_view();
} else {
LOG(FATAL) << "unexpected type" << static_cast<int>(type_.type_enum_);
return std::string_view();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,4 +399,10 @@ public static QueryContext get_movie_query28_test() {
List<String> expected = Arrays.asList("Record<{typeA: \"Person\", typeC: \"Movie\"}>");
return new QueryContext(query, expected);
}

public static QueryContext get_movie_query29_test() {
String query = "MATCH(a)-[r]->(b) where r.rating is null return count(r) as count;";
List<String> expected = Arrays.asList("Record<{count: 249}>");
return new QueryContext(query, expected);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,13 @@ public void run_movie_query28_test() {
Assert.assertEquals(testQuery.getExpectedResult().toString(), result.list().toString());
}

@Test
public void run_movie_query29_test() {
QueryContext testQuery = MovieQueries.get_movie_query29_test();
Result result = session.run(testQuery.getQuery());
Assert.assertEquals(testQuery.getExpectedResult().toString(), result.list().toString());
}

@AfterClass
public static void afterClass() {
if (session != null) {
Expand Down
Loading