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

Method FetchVectorFunction

src/db/sqlengine/planner/ops/fetch_vector_op.cc:133–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131}
132
133arrow::Status FetchVectorOp::FetchVectorFunction(cp::KernelContext *ctx,
134 const cp::ExecSpan &batch,
135 cp::ExecResult *out) {
136 FetchVectorState *state = static_cast<FetchVectorState *>(ctx->state());
137 if (state->args.indexer == nullptr) {
138 return arrow::Status::ExecutionError("indexer is null");
139 }
140
141 auto row_span = batch[0].array.GetSpan<uint64_t>(1, batch.length);
142 Result<std::shared_ptr<arrow::Array>> res;
143 if (state->args.is_dense) {
144 res = fetch_dense_vector_helper(state->args.indexer.get(), row_span.begin(),
145 row_span.end());
146 } else {
147 res = fetch_sparse_vector_helper(state->args.indexer.get(),
148 row_span.begin(), row_span.end());
149 }
150 if (!res) {
151 return arrow::Status::ExecutionError("fetch vector failed:",
152 res.error().c_str());
153 }
154
155 out->value = std::move(res.value()->data());
156 return arrow::Status::OK();
157}
158
159arrow::Result<std::unique_ptr<arrow::compute::KernelState>>
160FetchVectorOp::InitExprValue(arrow::compute::KernelContext *,

Callers

nothing calls this directly

Calls 11

OKFunction · 0.85
stateMethod · 0.80
c_strMethod · 0.80
getMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
errorMethod · 0.45
dataMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected