Skip to content
Open
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
30 changes: 29 additions & 1 deletion flex/engines/graph_db/runtime/common/operators/retrieve/get_v.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,11 @@ class GetV {
LOG(ERROR) << "output_vertex_label != params.tables[0]"
<< static_cast<int>(output_vertex_label) << " "
<< static_cast<int>(params.tables[0]);
RETURN_BAD_REQUEST_ERROR("output_vertex_label != params.tables[0]");
auto builder = SLVertexColumnBuilder::builder(output_vertex_label);
std::vector<size_t> offsets;
ctx.set_with_reshuffle(params.alias, builder.finish(nullptr),
offsets);
return ctx;
}
}
auto builder = SLVertexColumnBuilder::builder(output_vertex_label);
Expand Down Expand Up @@ -270,6 +274,30 @@ class GetV {
ctx.set_with_reshuffle(params.alias, builder.finish(nullptr),
shuffle_offset);
return ctx;
} else if (labels.size() == 1) {
auto builder = SLVertexColumnBuilder::builder(labels[0]);
if (opt == VOpt::kStart) {
input_edge_list.foreach_edge(
[&](size_t index, const LabelTriplet& label, vid_t src, vid_t dst,
const EdgeData& edata, Direction dir) {
if (label.src_label == labels[0]) {
builder.push_back_opt(src);
shuffle_offset.push_back(index);
}
});
} else if (opt == VOpt::kEnd) {
input_edge_list.foreach_edge(
[&](size_t index, const LabelTriplet& label, vid_t src, vid_t dst,
const EdgeData& edata, Direction dir) {
if (label.dst_label == labels[0]) {
builder.push_back_opt(dst);
shuffle_offset.push_back(index);
}
});
}
ctx.set_with_reshuffle(params.alias, builder.finish(nullptr),
shuffle_offset);
return ctx;
}
} else if (column->edge_column_type() == EdgeColumnType::kBDSL) {
auto& input_edge_list =
Expand Down
21 changes: 19 additions & 2 deletions flex/engines/graph_db/runtime/execute/ops/retrieve/edge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,24 @@ bl::result<ReadOpBuildResultT> EdgeExpandGetVOprBuilder::Build(

EdgeExpandParams eep;
eep.v_tag = v_tag;
eep.labels = parse_label_triplets(plan.plan(op_idx).meta_data(0));
auto temps = parse_label_triplets(plan.plan(op_idx).meta_data(0));
auto tables = parse_tables(v_opr.params());
if (tables.size() > 0) {
for (auto& label : temps) {
if ((dir == Direction::kIn || dir == Direction::kBoth) &&
std::find(tables.begin(), tables.end(), label.src_label) !=
tables.end()) {
eep.labels.emplace_back(label);
} else if ((dir == Direction::kOut || dir == Direction::kBoth) &&
std::find(tables.begin(), tables.end(), label.dst_label) !=
tables.end()) {
eep.labels.emplace_back(label);
}
}
} else {
eep.labels = temps;
}

eep.dir = dir;
eep.alias = alias;
eep.is_optional = is_optional;
Expand Down Expand Up @@ -731,4 +748,4 @@ bl::result<ReadOpBuildResultT> EdgeExpandGetVOprBuilder::Build(
} // namespace ops

} // namespace runtime
} // namespace gs
} // namespace gs
Loading