| 300 | |
| 301 | template <class T> |
| 302 | void 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 | |
| 342 | template <class T> |
| 343 | void CppAggregatesFx<T>::write_sparse( |
nothing calls this directly
no test coverage detected