mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-07 01:28:27 +08:00
Fix bug for erase while traversing (#26540)
Signed-off-by: cai.zhang <cai.zhang@zilliz.com>
This commit is contained in:
parent
e17cda23f4
commit
d6473028d1
@ -2333,20 +2333,14 @@ ExecExprVisitor::ExecJsonContainsAllArray(JsonContainsExpr& expr_raw)
|
|||||||
auto pointer = milvus::Json::pointer(expr.column_.nested_path);
|
auto pointer = milvus::Json::pointer(expr.column_.nested_path);
|
||||||
auto index_func = [](Index* index) { return TargetBitmap{}; };
|
auto index_func = [](Index* index) { return TargetBitmap{}; };
|
||||||
auto& elements = expr.elements_;
|
auto& elements = expr.elements_;
|
||||||
std::unordered_set<int> elements_index;
|
|
||||||
int i = 0;
|
auto elem_func = [&elements, &pointer](const milvus::Json& json) {
|
||||||
for (auto& element : expr.elements_) {
|
|
||||||
elements_index.insert(i);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
auto elem_func = [&elements, &elements_index, &pointer](
|
|
||||||
const milvus::Json& json) {
|
|
||||||
auto doc = json.doc();
|
auto doc = json.doc();
|
||||||
auto array = doc.at_pointer(pointer).get_array();
|
auto array = doc.at_pointer(pointer).get_array();
|
||||||
if (array.error()) {
|
if (array.error()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
std::unordered_set<int> tmp_elements_index(elements_index);
|
std::unordered_set<int> exist_elements_index;
|
||||||
for (auto&& it : array) {
|
for (auto&& it : array) {
|
||||||
auto val = it.get_array();
|
auto val = it.get_array();
|
||||||
if (val.error()) {
|
if (val.error()) {
|
||||||
@ -2358,19 +2352,16 @@ ExecExprVisitor::ExecJsonContainsAllArray(JsonContainsExpr& expr_raw)
|
|||||||
for (auto&& e : val) {
|
for (auto&& e : val) {
|
||||||
json_array.emplace_back(e);
|
json_array.emplace_back(e);
|
||||||
}
|
}
|
||||||
for (auto index : tmp_elements_index) {
|
for (int index = 0; index < elements.size(); ++index) {
|
||||||
if (compareTwoJsonArray(json_array, elements[index])) {
|
if (compareTwoJsonArray(json_array, elements[index])) {
|
||||||
tmp_elements_index.erase(index);
|
exist_elements_index.insert(index);
|
||||||
// TODO: construct array set.
|
|
||||||
// prevent expression json_contains_all(json_array, [[1,2], [3,4], [1,2]]) being unsuccessful
|
|
||||||
// break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tmp_elements_index.size() == 0) {
|
if (exist_elements_index.size() == elements.size()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return tmp_elements_index.size() == 0;
|
return exist_elements_index.size() == elements.size();
|
||||||
};
|
};
|
||||||
|
|
||||||
return ExecRangeVisitorImpl<milvus::Json>(
|
return ExecRangeVisitorImpl<milvus::Json>(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user