MCPcopy Create free account
hub / github.com/alibaba/zvec / execute

Method execute

src/db/sqlengine/sqlengine_impl.cc:58–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56 : profiler_(std::move(profiler)) {}
57
58Result<DocPtrList> SQLEngineImpl::execute(
59 CollectionSchema::Ptr collection, SearchQuery query,
60 const std::vector<Segment::Ptr> &segments) {
61 if (segments.empty()) {
62 return DocPtrList{};
63 }
64
65 // Check filter satisfiability once before the loop (result depends only on
66 // the query, not on segment data).
67 auto first_query_info = build_query_info(collection, query, nullptr);
68 if (!first_query_info) {
69 return tl::make_unexpected(first_query_info.error());
70 }
71 if (first_query_info.value()->is_filter_unsatisfiable()) {
72 LOG_WARN("filter is unsatisfiable: %s",
73 first_query_info.value()->to_string().c_str());
74 return {};
75 }
76 // Capture output field schema before query_infos are moved into the planner.
77 auto select_item_meta_ptrs =
78 first_query_info.value()->select_item_schema_ptrs();
79
80 // Build a separate QueryInfo per segment so the optimizer can mutate each
81 // independently. Reuse first_query_info for segment 0.
82 std::vector<QueryInfo::Ptr> query_infos;
83 query_infos.reserve(segments.size());
84 query_infos.emplace_back(std::move(first_query_info.value()));
85 for (size_t i = 1; i < segments.size(); ++i) {
86 auto query_info = build_query_info(collection, query, nullptr);
87 if (!query_info) {
88 return tl::make_unexpected(query_info.error());
89 }
90 query_infos.emplace_back(std::move(query_info.value()));
91 }
92 auto reader = search_by_query_info(collection, segments, &query_infos);
93 if (!reader) {
94 return tl::make_unexpected(Status::InternalError(
95 "Execute plan failed (query): ", reader.error().c_str()));
96 }
97 return fill_result(select_item_meta_ptrs, reader.value().get());
98}
99
100SearchQuery from_group_by(const GroupByVectorQuery &gq) {
101 SearchQuery sq;

Callers 15

do_build_by_streamerFunction · 0.45
runMethod · 0.45
runMethod · 0.45
runMethod · 0.45
runMethod · 0.45
do_build_by_streamerFunction · 0.45
DeleteByFilterMethod · 0.45
QueryMethod · 0.45
prepareMethod · 0.45
TESTFunction · 0.45

Calls 10

make_unexpectedFunction · 0.85
emptyMethod · 0.45
errorMethod · 0.45
valueMethod · 0.45
c_strMethod · 0.45
to_stringMethod · 0.45
reserveMethod · 0.45
sizeMethod · 0.45
getMethod · 0.45

Tested by 15

TESTFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36
test_lockFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36
fts_searchMethod · 0.36