MCPcopy Create free account
hub / github.com/TileDB-Inc/TileDB / make_data_buff

Method make_data_buff

test/src/test-cppapi-aggregates.cc:486–514  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

484
485template <class T>
486std::vector<uint8_t> CppAggregatesFx<T>::make_data_buff(
487 std::vector<int> values, optional<std::vector<uint8_t>> validity) {
488 std::vector<T> data;
489 if (validity.has_value()) {
490 auto a = tiledb::Attribute::create<T>(ctx_, "unused");
491 const void* fill_value = nullptr;
492 uint64_t size = 0;
493 a.get_fill_value(&fill_value, &size);
494
495 for (uint64_t i = 0; i < values.size(); i++) {
496 auto v = values[i];
497 if (set_qc_ &&
498 (v == 4 || v == 35 || (nullable_ && validity.value()[i] == 0))) {
499 data.emplace_back(*(const T*)fill_value);
500 } else {
501 data.emplace_back(static_cast<T>(v));
502 }
503 }
504 } else {
505 for (auto& v : values) {
506 data.emplace_back(static_cast<T>(v));
507 }
508 }
509
510 std::vector<uint8_t> ret(data.size() * sizeof(T));
511 memcpy(ret.data(), data.data(), ret.size());
512
513 return ret;
514}
515
516template <>
517std::vector<uint8_t> CppAggregatesFx<std::string>::make_data_buff(

Callers 1

Calls 5

has_valueMethod · 0.80
get_fill_valueMethod · 0.45
sizeMethod · 0.45
valueMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected