| 131 | } |
| 132 | |
| 133 | arrow::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 | |
| 159 | arrow::Result<std::unique_ptr<arrow::compute::KernelState>> |
| 160 | FetchVectorOp::InitExprValue(arrow::compute::KernelContext *, |
nothing calls this directly
no test coverage detected