Fix for in list segmentation fault (#1494)
This commit is contained in:
parent
0756cd6898
commit
e907817854
@ -43,23 +43,6 @@ struct CachedValue {
|
||||
return cache_.get_allocator().GetMemoryResource();
|
||||
}
|
||||
|
||||
// Func to check if cache_ contains value
|
||||
bool CacheValue(TypedValue &&maybe_list) {
|
||||
if (!maybe_list.IsList()) {
|
||||
return false;
|
||||
}
|
||||
auto &list = maybe_list.ValueList();
|
||||
TypedValue::Hash hash{};
|
||||
for (auto &element : list) {
|
||||
const auto key = hash(element);
|
||||
auto &vector_values = cache_[key];
|
||||
if (!IsValueInVec(vector_values, element)) {
|
||||
vector_values.emplace_back(std::move(element));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CacheValue(const TypedValue &maybe_list) {
|
||||
if (!maybe_list.IsList()) {
|
||||
return false;
|
||||
|
@ -315,8 +315,8 @@ class ExpressionEvaluator : public ExpressionVisitor<TypedValue> {
|
||||
return std::move(*preoperational_checks);
|
||||
}
|
||||
auto &cached_value = frame_change_collector_->GetCachedValue(*cached_id);
|
||||
cached_value.CacheValue(std::move(list));
|
||||
spdlog::trace("Value cached {}", *cached_id);
|
||||
// Don't move here because we don't want to remove the element from the frame
|
||||
cached_value.CacheValue(list);
|
||||
}
|
||||
const auto &cached_value = frame_change_collector_->GetCachedValue(*cached_id);
|
||||
|
||||
@ -338,7 +338,6 @@ class ExpressionEvaluator : public ExpressionVisitor<TypedValue> {
|
||||
}
|
||||
|
||||
const auto &list_value = list.ValueList();
|
||||
spdlog::trace("Not using cache on IN LIST operator");
|
||||
auto has_null = false;
|
||||
for (const auto &element : list_value) {
|
||||
auto result = literal == element;
|
||||
|
@ -1535,7 +1535,6 @@ inline static void TryCaching(const AstStorage &ast_storage, FrameChangeCollecto
|
||||
continue;
|
||||
}
|
||||
frame_change_collector->AddTrackingKey(*cached_id);
|
||||
spdlog::trace("Tracking {} operator, by id: {}", InListOperator::kType.name, *cached_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -263,3 +263,19 @@ Feature: List operators
|
||||
| id |
|
||||
| 1 |
|
||||
| 2 |
|
||||
|
||||
Scenario: InList 01
|
||||
Given an empty graph
|
||||
And having executed
|
||||
"""
|
||||
CREATE (o:Node) SET o.Status = 'This is the status';
|
||||
"""
|
||||
When executing query:
|
||||
"""
|
||||
match (o:Node)
|
||||
where o.Status IN ['This is not the status', 'This is the status']
|
||||
return o;
|
||||
"""
|
||||
Then the result should be:
|
||||
| o |
|
||||
| (:Node {Status: 'This is the status'}) |
|
||||
|
Loading…
Reference in New Issue
Block a user