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

Method execute

src/db/sqlengine/sqlengine_impl.cc:59–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Calls 11

make_unexpectedFunction · 0.85
InternalErrorFunction · 0.85
c_strMethod · 0.80
emptyMethod · 0.45
errorMethod · 0.45
valueMethod · 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