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

Method write_sparse

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

Source from the content-addressed store, hash-verified

300
301template <class T>
302void CppAggregatesFx<T>::write_sparse(
303 std::vector<int> a,
304 std::vector<uint64_t> dim1,
305 std::vector<uint64_t> dim2,
306 uint64_t timestamp,
307 optional<std::vector<uint8_t>> a_validity) {
308 // Open array.
309 Array array(
310 ctx_,
311 ARRAY_NAME,
312 TILEDB_WRITE,
313 TemporalPolicy(TimestampStartEnd, 0, timestamp));
314
315 std::vector<uint8_t> a_buff = make_data_buff(a);
316 uint64_t cell_val_num = std::is_same<T, std::string>::value ?
317 CppAggregatesFx<T>::STRING_CELL_VAL_NUM :
318 1;
319
320 // Create query.
321 Query query(ctx_, array, TILEDB_WRITE);
322 query.set_layout(TILEDB_GLOBAL_ORDER);
323 query.set_data_buffer(
324 "a1", static_cast<void*>(a_buff.data()), a.size() * cell_val_num);
325 query.set_data_buffer(
326 "a2", static_cast<void*>(a_buff.data()), a.size() * cell_val_num);
327 query.set_data_buffer("d1", dim1);
328 query.set_data_buffer("d2", dim2);
329 if (a_validity.has_value()) {
330 query.set_validity_buffer("a1", a_validity.value());
331 query.set_validity_buffer("a2", a_validity.value());
332 }
333
334 // Submit/finalize the query.
335 query.submit();
336 query.finalize();
337
338 // Close array.
339 array.close();
340}
341
342template <class T>
343void CppAggregatesFx<T>::write_sparse(

Callers

nothing calls this directly

Calls 12

TemporalPolicyClass · 0.85
has_valueMethod · 0.80
set_layoutMethod · 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
closeMethod · 0.45
set_offsets_bufferMethod · 0.45

Tested by

no test coverage detected