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

add op_node_index_seek_byrange #650

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
fix code format
  • Loading branch information
ncbd committed Aug 30, 2024
commit 5c359a28617c6cb9327e57d8365b8ad8c2bad1b3
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class LocateNodeByIndexedProp : public OptPass {
OpBase::FreeStream(op_filter);
op_filter = nullptr;
op_post->AddChild(op_node_index_seek);
}
}
// else if (cmpOp == lgraph::CompareOp::LBR_GT ||
// cmpOp == lgraph::CompareOp::LBR_LT) {
// auto op_node_index_seek_byrange
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#pragma once

#include "execution_plan/ops/op.h"
#include "execution_plan/ops/op_node_index_seek_byrange.h"
#include "geax-front-end/ast/AstNode.h"
#include "tools/lgraph_log.h"
Expand Down Expand Up @@ -69,40 +70,28 @@ class LocateNodeByIndexedPropV2 : public OptPass {
// try to reuse NodeIndexSeek
// Here implemention of NodeIndexSeek is tweaked to support multiple static values
// Reason that not to build unwind:unwind needs one more symbol in symbol table
if(cmpOp == geax::frontend::AstNodeType::kBSmallerThan ||
auto it = target_value_datas.find(node->Alias());
if (it == target_value_datas.end()) return;
CYPHER_THROW_ASSERT(it->second.size() == 1);
std::vector<lgraph::FieldData> values;
std::string field;
for (auto & [f, set] : it->second) {
values.insert(values.end(), set.begin(), set.end());
field = f;
}
OpBase* op_node_index_operation;
if (cmpOp == geax::frontend::AstNodeType::kBSmallerThan ||
cmpOp == geax::frontend::AstNodeType::kBGreaterThan) {
auto it = target_value_datas.find(node->Alias());
if (it == target_value_datas.end()) return;
CYPHER_THROW_ASSERT(it->second.size() == 1);
std::vector<lgraph::FieldData> values;
std::string field;
for (auto & [f, set] : it->second) {
values.insert(values.end(), set.begin(), set.end());
field = f;
}
auto op_node_index_byrange = new NodeIndexSeekByRange(node, symtab, field, values, cmpOp);
op_node_index_byrange->parent = op_post;
op_post->RemoveChild(op_filter);
OpBase::FreeStream(op_filter);
op_filter = nullptr;
op_post->AddChild(op_node_index_byrange);
op_node_index_operation = new NodeIndexSeekByRange(node, symtab, field,
values, cmpOp);
} else {
auto it = target_value_datas.find(node->Alias());
if (it == target_value_datas.end()) return;
CYPHER_THROW_ASSERT(it->second.size() == 1);
std::vector<lgraph::FieldData> values;
std::string field;
for (auto & [f, set] : it->second) {
values.insert(values.end(), set.begin(), set.end());
field = f;
}
auto op_node_index_seek = new NodeIndexSeek(node, symtab, field, values);
op_node_index_seek->parent = op_post;
op_post->RemoveChild(op_filter);
OpBase::FreeStream(op_filter);
op_filter = nullptr;
op_post->AddChild(op_node_index_seek);
op_node_index_operation = new NodeIndexSeek(node, symtab, field, values);
}
op_node_index_operation->parent = op_post;
op_post->RemoveChild(op_filter);
OpBase::FreeStream(op_filter);
op_filter = nullptr;
op_post->AddChild(op_node_index_operation);
}
}

Expand Down
Loading