| 386 | |
| 387 | template <class T> |
| 388 | void 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 | |
| 433 | template <class T> |
| 434 | void CppAggregatesFx<T>::write_dense_string( |
nothing calls this directly
no test coverage detected