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

Method write_dense

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

Source from the content-addressed store, hash-verified

386
387template <class T>
388void CppAggregatesFx<T>::write_dense(
389 std::vector<int> a,
390 uint64_t dim1_min,
391 uint64_t dim1_max,
392 uint64_t dim2_min,
393 uint64_t dim2_max,
394 uint64_t timestamp,
395 optional<std::vector<uint8_t>> a_validity) {
396 // Open array.
397 Array array(
398 ctx_,
399 ARRAY_NAME,
400 TILEDB_WRITE,
401 TemporalPolicy(TimestampStartEnd, 0, timestamp));
402
403 std::vector<uint8_t> a_buff = make_data_buff(a);
404 uint64_t cell_val_num = std::is_same<T, std::string>::value ?
405 CppAggregatesFx<T>::STRING_CELL_VAL_NUM :
406 1;
407
408 // Create the subarray.
409 Subarray subarray(ctx_, array);
410 subarray.add_range(0, dim1_min, dim1_max).add_range(1, dim2_min, dim2_max);
411
412 // Create query.
413 Query query(ctx_, array, TILEDB_WRITE);
414 query.set_layout(TILEDB_ROW_MAJOR);
415 query.set_subarray(subarray);
416 query.set_data_buffer(
417 "a1", static_cast<void*>(a_buff.data()), a.size() * cell_val_num);
418 query.set_data_buffer(
419 "a2", static_cast<void*>(a_buff.data()), a.size() * cell_val_num);
420 if (a_validity.has_value()) {
421 query.set_validity_buffer("a1", a_validity.value());
422 query.set_validity_buffer("a2", a_validity.value());
423 }
424
425 // Submit/finalize the query.
426 query.submit();
427 query.finalize();
428
429 // Close array.
430 array.close();
431}
432
433template <class T>
434void CppAggregatesFx<T>::write_dense_string(

Callers

nothing calls this directly

Calls 13

TemporalPolicyClass · 0.85
has_valueMethod · 0.80
add_rangeMethod · 0.45
set_layoutMethod · 0.45
set_subarrayMethod · 0.45
set_data_bufferMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
set_validity_bufferMethod · 0.45
valueMethod · 0.45
submitMethod · 0.45
finalizeMethod · 0.45

Tested by

no test coverage detected