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

Function fill_doc_vector

src/db/sqlengine/sqlengine_impl.cc:398–417  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

396
397template <typename VectorType>
398Status fill_doc_vector(const arrow::BinaryArray *typed_arr,
399 const std::string &field_name, int dimension,
400 DocPtrList::iterator doc_it) {
401 bool no_null = typed_arr->null_count() == 0;
402 for (int64_t i = 0; i < typed_arr->length(); ++i, ++doc_it) {
403 if (no_null || !typed_arr->IsNull(i)) {
404 auto data = typed_arr->GetView(i);
405 if ((size_t)dimension != data.size() / sizeof(VectorType)) {
406 return Status::InvalidArgument(
407 "Vector dimension not match [", field_name,
408 "]: expected dimension=", dimension,
409 " vs actual dimension=", data.size() / sizeof(VectorType));
410 }
411 (*doc_it)->set(field_name, std::vector<VectorType>(
412 (const VectorType *)&data[0],
413 (const VectorType *)&data[0] + dimension));
414 }
415 }
416 return Status::OK();
417}
418
419Status fill_doc_field(const std::shared_ptr<arrow::Array> &chunk,
420 const FieldSchema &field_schema,

Callers

nothing calls this directly

Calls 5

InvalidArgumentFunction · 0.85
OKFunction · 0.85
lengthMethod · 0.80
sizeMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected