From 1154ce9d105df229236a3f8b2f6c4cd1090f1200 Mon Sep 17 00:00:00 2001 From: Theodore Tsirpanis Date: Tue, 16 Jul 2024 22:00:32 +0300 Subject: [PATCH] Remove all deprecated APIs. (#5146) [SC-50038](https://app.shortcut.com/tiledb-inc/story/50038/remove-deprecated-apis) Consistent with [the announcement made in 2.23.0's release notes](https://github.com/TileDB-Inc/TileDB/releases/tag/2.23.0), this PR removes all deprecated C and C++ APIs. The infrastructure supporting the `TILEDB_REMOVE_DEPRECATIONS` CMake option was kept, in case we want to deprecate another API in the future. --- TYPE: BREAKING_API DESC: All deprecated C and C++ APIs were removed. --- test/src/cpp-integration-query-condition.cc | 24 +- test/src/unit-arrow.cc | 4 +- test/src/unit-backwards_compat.cc | 13 +- test/src/unit-capi-serialized_queries.cc | 2 +- test/src/unit-cppapi-checksum.cc | 2 +- ...it-cppapi-consolidation-with-timestamps.cc | 18 +- test/src/unit-cppapi-datetimes.cc | 6 +- test/src/unit-cppapi-deletes.cc | 6 +- test/src/unit-cppapi-filter.cc | 2 +- test/src/unit-cppapi-metadata.cc | 6 +- .../unit-cppapi-partial-attribute-write.cc | 12 +- test/src/unit-cppapi-query.cc | 6 +- test/src/unit-cppapi-time.cc | 6 +- test/src/unit-tile-metadata.cc | 2 +- tiledb/CMakeLists.txt | 3 - tiledb/api/c_api/group/group_api.cc | 102 -- tiledb/api/c_api/group/group_api_external.h | 83 +- tiledb/sm/c_api/tiledb.cc | 803 +--------- tiledb/sm/c_api/tiledb.h | 23 +- tiledb/sm/c_api/tiledb_deprecated.h | 584 +------- tiledb/sm/c_api/tiledb_experimental.h | 35 +- tiledb/sm/cpp_api/array.h | 25 +- tiledb/sm/cpp_api/array_deprecated.h | 504 ------- tiledb/sm/cpp_api/array_schema.h | 7 - tiledb/sm/cpp_api/array_schema_deprecated.h | 93 -- tiledb/sm/cpp_api/core_interface.h | 23 - tiledb/sm/cpp_api/query.h | 168 --- tiledb/sm/cpp_api/query_deprecated.h | 1298 ----------------- 28 files changed, 119 insertions(+), 3741 deletions(-) delete mode 100644 tiledb/sm/cpp_api/array_deprecated.h delete mode 100644 tiledb/sm/cpp_api/array_schema_deprecated.h delete mode 100644 tiledb/sm/cpp_api/query_deprecated.h diff --git a/test/src/cpp-integration-query-condition.cc b/test/src/cpp-integration-query-condition.cc index eaeb7b4cb0b..8e4a60af9c4 100644 --- a/test/src/cpp-integration-query-condition.cc +++ b/test/src/cpp-integration-query-condition.cc @@ -1566,7 +1566,7 @@ TEST_CASE( subarray_w.add_range("d", range[0], range[1]); query_w.set_subarray(subarray_w); query_w.set_layout(TILEDB_ROW_MAJOR); - query_w.set_buffer("a", vals); + query_w.set_data_buffer("a", vals); REQUIRE(query_w.submit() == Query::Status::COMPLETE); // Write values from 3-6 as 7 in the array. @@ -1577,7 +1577,7 @@ TEST_CASE( subarray_w2.add_range("d", range2[0], range2[1]); query_w2.set_subarray(subarray_w2); query_w2.set_layout(TILEDB_ROW_MAJOR); - query_w2.set_buffer("a", vals2); + query_w2.set_data_buffer("a", vals2); REQUIRE(query_w2.submit() == Query::Status::COMPLETE); array.close(); @@ -1596,7 +1596,7 @@ TEST_CASE( subarray_r.add_range("d", range[0], range[1]); query_r.set_subarray(subarray_r); query_r.set_layout(TILEDB_ROW_MAJOR); - query_r.set_buffer("a", vals_read); + query_r.set_data_buffer("a", vals_read); query_r.set_condition(qc); REQUIRE(query_r.submit() == Query::Status::COMPLETE); @@ -1645,17 +1645,17 @@ TEST_CASE( // Write all values as 3 in the array. std::vector vals = {3, 3, 3, 3, 3, 3, 3, 3, 3, 3}; Query query_w(ctx, array, TILEDB_WRITE); - query_w.set_buffer("d", dim_vals); - query_w.set_buffer("a", vals); - query_w.set_buffer("a2", vals); + query_w.set_data_buffer("d", dim_vals); + query_w.set_data_buffer("a", vals); + query_w.set_data_buffer("a2", vals); REQUIRE(query_w.submit() == Query::Status::COMPLETE); // Write values from 1-10 as 7 in the array. std::vector vals2 = {7, 7, 7, 7, 7, 7, 7, 7, 7, 6}; Query query_w2(ctx, array, TILEDB_WRITE); - query_w2.set_buffer("d", dim_vals); - query_w2.set_buffer("a", vals2); - query_w2.set_buffer("a2", vals); + query_w2.set_data_buffer("d", dim_vals); + query_w2.set_data_buffer("a", vals2); + query_w2.set_data_buffer("a2", vals); REQUIRE(query_w2.submit() == Query::Status::COMPLETE); array.close(); @@ -1673,9 +1673,9 @@ TEST_CASE( std::vector dim_vals_read(10); Query query_r(ctx, array_r, TILEDB_READ); query_r.set_layout(TILEDB_GLOBAL_ORDER); - query_r.set_buffer("a", vals_read); - query_r.set_buffer("a2", vals_read2); - query_r.set_buffer("d", dim_vals_read); + query_r.set_data_buffer("a", vals_read); + query_r.set_data_buffer("a2", vals_read2); + query_r.set_data_buffer("d", dim_vals_read); query_r.set_condition(qc); REQUIRE(query_r.submit() == Query::Status::COMPLETE); diff --git a/test/src/unit-arrow.cc b/test/src/unit-arrow.cc index 0b126f894e2..70e03ee3b88 100644 --- a/test/src/unit-arrow.cc +++ b/test/src/unit-arrow.cc @@ -166,7 +166,9 @@ void allocate_query_buffers(tiledb::Query* const query) { bool has_ranges = false; for (uint64_t dim_idx = 0; dim_idx < schema.domain().ndim(); dim_idx++) { - if (query->range_num(dim_idx) > 0) { + Subarray subarray(query->ctx(), query->array()); + query->update_subarray_from_query(&subarray); + if (subarray.range_num(dim_idx) > 0) { has_ranges = true; break; } diff --git a/test/src/unit-backwards_compat.cc b/test/src/unit-backwards_compat.cc index 6839dd9d418..554cef7a9c3 100644 --- a/test/src/unit-backwards_compat.cc +++ b/test/src/unit-backwards_compat.cc @@ -83,7 +83,7 @@ void set_query_coords( Subarray sub(ctx, *array); sub.set_subarray(static_cast(subarray), 2 * ndim); - query->set_coordinates(static_cast(*coordinates), ndim); + query->set_data_buffer("__coords", static_cast(*coordinates), ndim); query->set_subarray(sub); std::free(subarray); @@ -136,8 +136,9 @@ void set_query_var_dimension_buffer( memset(*offsets, 0, sizeof(uint64_t)); memset(*buffer, 0, buffer_size); - query->set_buffer( - dimension.name(), *offsets, 1, static_cast(*buffer), buffer_size); + query->set_data_buffer( + dimension.name(), static_cast(*buffer), buffer_size); + query->set_offsets_buffer(dimension.name(), *offsets, 1); subarray->add_range(dim_idx, std::string("1"), std::string("1")); } @@ -208,7 +209,7 @@ TEST_CASE( query_r.set_subarray(sub) .set_layout(TILEDB_ROW_MAJOR) .set_data_buffer("a", a_read) - .set_coordinates(coords_read); + .set_data_buffer("__coords", coords_read); query_r.submit(); // Note: If you encounter a failure here, in particular with a_read[0] == 100 @@ -720,7 +721,7 @@ TEST_CASE( Query query_w(ctx, old_array); query_w.set_layout(TILEDB_UNORDERED) .set_data_buffer("a", a_write) - .set_coordinates(coords_write); + .set_data_buffer("__coords", coords_write); query_w.submit(); old_array.close(); @@ -736,7 +737,7 @@ TEST_CASE( query_r.set_subarray(subarray_r) .set_layout(TILEDB_ROW_MAJOR) .set_data_buffer("a", a_read) - .set_coordinates(coords_read); + .set_data_buffer("__coords", coords_read); query_r.submit(); array.close(); diff --git a/test/src/unit-capi-serialized_queries.cc b/test/src/unit-capi-serialized_queries.cc index e7413d6a5f1..55698ebd11f 100644 --- a/test/src/unit-capi-serialized_queries.cc +++ b/test/src/unit-capi-serialized_queries.cc @@ -704,7 +704,7 @@ TEST_CASE_METHOD( Subarray cppapi_subarray(ctx, array); cppapi_subarray.set_subarray(subarray); query.set_subarray(cppapi_subarray); - query.set_coordinates(coords); + query.set_data_buffer("__coords", coords); query.set_data_buffer("a1", a1); query.set_data_buffer("a2", a2); query.set_validity_buffer("a2", a2_nullable); diff --git a/test/src/unit-cppapi-checksum.cc b/test/src/unit-cppapi-checksum.cc index 89a91dae8be..bf489a4d7fb 100644 --- a/test/src/unit-cppapi-checksum.cc +++ b/test/src/unit-cppapi-checksum.cc @@ -94,7 +94,7 @@ static void run_checksum_test(tiledb_filter_type_t filter_type) { query.set_data_buffer("a1", a1_data) .set_data_buffer("a2", a2buf.second) .set_offsets_buffer("a2", a2buf.first) - .set_coordinates(coords) + .set_data_buffer("__coords", coords) .set_layout(TILEDB_UNORDERED); REQUIRE(query.submit() == Query::Status::COMPLETE); diff --git a/test/src/unit-cppapi-consolidation-with-timestamps.cc b/test/src/unit-cppapi-consolidation-with-timestamps.cc index 5370a65cfb0..8902d53c5f4 100644 --- a/test/src/unit-cppapi-consolidation-with-timestamps.cc +++ b/test/src/unit-cppapi-consolidation-with-timestamps.cc @@ -167,7 +167,11 @@ void ConsolidationWithTimestampsFx::write_sparse( std::vector dim2, uint64_t timestamp) { // Open array. - Array array(ctx_, SPARSE_ARRAY_NAME, TILEDB_WRITE, timestamp); + Array array( + ctx_, + SPARSE_ARRAY_NAME, + TILEDB_WRITE, + tiledb::TemporalPolicy(tiledb::TimeTravel, timestamp)); // Create query. Query query(ctx_, array, TILEDB_WRITE); @@ -193,7 +197,11 @@ void ConsolidationWithTimestampsFx::write_sparse_v11(uint64_t timestamp) { std::vector buffer_coords_dim2{1, 2, 4, 3}; // Open array. - Array array(ctx_, SPARSE_ARRAY_NAME, TILEDB_WRITE, timestamp); + Array array( + ctx_, + SPARSE_ARRAY_NAME, + TILEDB_WRITE, + tiledb::TemporalPolicy(tiledb::TimeTravel, timestamp)); // Create query. Query query(ctx_, array, TILEDB_WRITE); @@ -290,7 +298,11 @@ void ConsolidationWithTimestampsFx::read_sparse( uint64_t timestamp, std::vector* timestamps_ptr) { // Open array. - Array array(ctx_, SPARSE_ARRAY_NAME, TILEDB_READ, timestamp); + Array array( + ctx_, + SPARSE_ARRAY_NAME, + TILEDB_READ, + tiledb::TemporalPolicy(tiledb::TimeTravel, timestamp)); // Create query. Query query(ctx_, array, TILEDB_READ); diff --git a/test/src/unit-cppapi-datetimes.cc b/test/src/unit-cppapi-datetimes.cc index e5e94ab0f85..d686635c101 100644 --- a/test/src/unit-cppapi-datetimes.cc +++ b/test/src/unit-cppapi-datetimes.cc @@ -64,7 +64,7 @@ TEST_CASE("C++ API: Datetime attribute", "[cppapi][datetime]") { Query query_w(ctx, array_w); query_w.set_layout(TILEDB_UNORDERED) .set_data_buffer("a", data_w) - .set_coordinates(coords_w) + .set_data_buffer("__coords", coords_w) .submit(); query_w.finalize(); array_w.close(); @@ -76,7 +76,7 @@ TEST_CASE("C++ API: Datetime attribute", "[cppapi][datetime]") { Query query_r(ctx, array_r); query_r.set_layout(TILEDB_ROW_MAJOR) .set_data_buffer("a", data_r) - .set_coordinates(coords_r); + .set_data_buffer("__coords", coords_r); REQUIRE(query_r.submit() == Query::Status::COMPLETE); auto result_num = query_r.result_buffer_elements()["a"].second; @@ -118,7 +118,7 @@ TEST_CASE("C++ API: Datetime dimension", "[cppapi][datetime]") { Query query_w(ctx, array_w); query_w.set_layout(TILEDB_UNORDERED) .set_data_buffer("a", data_w) - .set_coordinates(coords_w) + .set_data_buffer("__coords", coords_w) .submit(); query_w.finalize(); array_w.close(); diff --git a/test/src/unit-cppapi-deletes.cc b/test/src/unit-cppapi-deletes.cc index 8373b9f8023..4de2a60f8bd 100644 --- a/test/src/unit-cppapi-deletes.cc +++ b/test/src/unit-cppapi-deletes.cc @@ -271,7 +271,11 @@ void DeletesFx::write_sparse_v11(uint64_t timestamp) { std::vector buffer_coords_dim2{1, 2, 4, 3}; // Open array. - Array array(ctx_, array_name_.c_str(), TILEDB_WRITE, timestamp); + Array array( + ctx_, + array_name_.c_str(), + TILEDB_WRITE, + tiledb::TemporalPolicy(tiledb::TimeTravel, timestamp)); // Create query. Query query(ctx_, array, TILEDB_WRITE); diff --git a/test/src/unit-cppapi-filter.cc b/test/src/unit-cppapi-filter.cc index f6e8e0ba3ab..4b0b1cc3d93 100644 --- a/test/src/unit-cppapi-filter.cc +++ b/test/src/unit-cppapi-filter.cc @@ -195,7 +195,7 @@ TEST_CASE( query.set_data_buffer("a1", a1_data) .set_data_buffer("a2", a2buf.second) .set_offsets_buffer("a2", a2buf.first) - .set_coordinates(coords) + .set_data_buffer("__coords", coords) .set_layout(TILEDB_UNORDERED); REQUIRE(query.submit() == Query::Status::COMPLETE); array.close(); diff --git a/test/src/unit-cppapi-metadata.cc b/test/src/unit-cppapi-metadata.cc index 23e095b63db..7095daf8146 100644 --- a/test/src/unit-cppapi-metadata.cc +++ b/test/src/unit-cppapi-metadata.cc @@ -313,7 +313,11 @@ TEST_CASE_METHOD( // Create and open array in write mode tiledb::Context ctx; - tiledb::Array array(ctx, std::string(array_name_), TILEDB_WRITE, 1); + tiledb::Array array( + ctx, + std::string(array_name_), + TILEDB_WRITE, + tiledb::TemporalPolicy(tiledb::TimeTravel, 1)); // Write items int32_t v = 5; diff --git a/test/src/unit-cppapi-partial-attribute-write.cc b/test/src/unit-cppapi-partial-attribute-write.cc index 4b81ee8a357..cc4b2736302 100644 --- a/test/src/unit-cppapi-partial-attribute-write.cc +++ b/test/src/unit-cppapi-partial-attribute-write.cc @@ -128,7 +128,11 @@ void CppPartialAttrWriteFx::write_sparse_dims( std::unique_ptr& array, std::unique_ptr& query) { // Open array. - array = std::make_unique(ctx_, array_name_, TILEDB_WRITE, timestamp); + array = std::make_unique( + ctx_, + array_name_, + TILEDB_WRITE, + tiledb::TemporalPolicy(tiledb::TimeTravel, timestamp)); // Create query. query = std::make_unique(ctx_, *array, TILEDB_WRITE); @@ -148,7 +152,11 @@ void CppPartialAttrWriteFx::write_sparse_dims_and_a1( std::unique_ptr& array, std::unique_ptr& query) { // Open array. - array = std::make_unique(ctx_, array_name_, TILEDB_WRITE, timestamp); + array = std::make_unique( + ctx_, + array_name_, + TILEDB_WRITE, + tiledb::TemporalPolicy(tiledb::TimeTravel, timestamp)); // Create query. query = std::make_unique(ctx_, *array, TILEDB_WRITE); diff --git a/test/src/unit-cppapi-query.cc b/test/src/unit-cppapi-query.cc index f04df5d755a..a161e394295 100644 --- a/test/src/unit-cppapi-query.cc +++ b/test/src/unit-cppapi-query.cc @@ -195,7 +195,7 @@ TEST_CASE( std::vector coords_w = {0, 0, 1, 1, 2, 2, 3, 3}; Array array_w(ctx, array_name, TILEDB_WRITE); Query query_w(ctx, array_w); - query_w.set_coordinates(coords_w) + query_w.set_data_buffer("__coords", coords_w) .set_layout(TILEDB_UNORDERED) .set_data_buffer("a", data_w); query_w.submit(); @@ -221,7 +221,7 @@ TEST_CASE( // Open and write to the same array without closing it. Array array2(ctx, array_name, TILEDB_WRITE); Query query2(ctx, array2); - query2.set_coordinates(coords_w) + query2.set_data_buffer("__coords", coords_w) .set_layout(TILEDB_UNORDERED) .set_data_buffer("a", data_w); query2.submit(); @@ -324,7 +324,7 @@ TEST_CASE( std::vector coords_w = {0, 0, 1, 1, 2, 2, 3, 3}; Array array_w(ctx, array_name, TILEDB_WRITE); Query query_w(ctx, array_w); - query_w.set_coordinates(coords_w) + query_w.set_data_buffer("__coords", coords_w) .set_layout(TILEDB_UNORDERED) .set_data_buffer("a", data_w); query_w.submit(); diff --git a/test/src/unit-cppapi-time.cc b/test/src/unit-cppapi-time.cc index 37a92ac2312..e9672828d08 100644 --- a/test/src/unit-cppapi-time.cc +++ b/test/src/unit-cppapi-time.cc @@ -74,7 +74,7 @@ TEST_CASE("C++ API: Time attribute", "[cppapi][Time]") { Query query_w(ctx, array_w); query_w.set_layout(TILEDB_UNORDERED) .set_data_buffer("a", data_w) - .set_coordinates(coords_w) + .set_data_buffer("__coords", coords_w) .submit(); query_w.finalize(); array_w.close(); @@ -86,7 +86,7 @@ TEST_CASE("C++ API: Time attribute", "[cppapi][Time]") { Query query_r(ctx, array_r); query_r.set_layout(TILEDB_ROW_MAJOR) .set_data_buffer("a", data_r) - .set_coordinates(coords_r); + .set_data_buffer("__coords", coords_r); REQUIRE(query_r.submit() == Query::Status::COMPLETE); auto result_num = query_r.result_buffer_elements()["a"].second; @@ -138,7 +138,7 @@ TEST_CASE("C++ API: Time dimension", "[cppapi][time]") { Query query_w(ctx, array_w); query_w.set_layout(TILEDB_UNORDERED) .set_data_buffer("a", data_w) - .set_coordinates(coords_w) + .set_data_buffer("__coords", coords_w) .submit(); query_w.finalize(); array_w.close(); diff --git a/test/src/unit-tile-metadata.cc b/test/src/unit-tile-metadata.cc index f967bf7efe3..94b81b1470b 100644 --- a/test/src/unit-tile-metadata.cc +++ b/test/src/unit-tile-metadata.cc @@ -806,7 +806,7 @@ struct CPPVarTileMetadataFx { query.set_data_buffer("d", d); } query.set_offsets_buffer("a", a_offsets); - query.set_buffer("a", a_var); + query.set_data_buffer("a", a_var); if (nullable) { query.set_validity_buffer("a", a_val); diff --git a/tiledb/CMakeLists.txt b/tiledb/CMakeLists.txt index 8ddc93aef12..96c131d768c 100644 --- a/tiledb/CMakeLists.txt +++ b/tiledb/CMakeLists.txt @@ -79,11 +79,9 @@ if (TILEDB_CPP_API) list(APPEND TILEDB_PUBLIC_HEADERS ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/cpp_api/tiledb ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/cpp_api/tiledb_experimental - ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/cpp_api/array_deprecated.h ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/cpp_api/array.h ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/cpp_api/array_experimental.h ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/cpp_api/array_schema.h - ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/cpp_api/array_schema_deprecated.h ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/cpp_api/array_schema_evolution.h ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/cpp_api/array_schema_experimental.h ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/cpp_api/as_built_experimental.h @@ -113,7 +111,6 @@ if (TILEDB_CPP_API) ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/cpp_api/query_channel.h ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/cpp_api/query_condition_experimental.h ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/cpp_api/query_condition.h - ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/cpp_api/query_deprecated.h ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/cpp_api/query_experimental.h ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/cpp_api/schema_base.h ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/cpp_api/stats.h diff --git a/tiledb/api/c_api/group/group_api.cc b/tiledb/api/c_api/group/group_api.cc index b5204a2e4d2..03e56d14389 100644 --- a/tiledb/api/c_api/group/group_api.cc +++ b/tiledb/api/c_api/group/group_api.cc @@ -294,58 +294,6 @@ capi_return_t tiledb_group_get_member_count( return TILEDB_OK; } -capi_return_t tiledb_group_get_member_by_index( - tiledb_group_handle_t* group, - uint64_t index, - char** uri, - tiledb_object_t* type, - char** name) { - ensure_group_is_valid(group); - ensure_output_pointer_is_valid(uri); - ensure_output_pointer_is_valid(type); - ensure_output_pointer_is_valid(name); - - LOG_WARN( - "tiledb_group_get_member_by_index is deprecated. Please use " - "tiledb_group_get_member_by_index_v2 instead."); - - char* tmp_uri = nullptr; - char* tmp_name = nullptr; - - auto&& [uri_str, object_type, name_str] = - group->group().member_by_index(index); - - tmp_uri = copy_string(uri_str); - if (tmp_uri == nullptr) { - goto error; - } - - if (name_str.has_value()) { - tmp_name = copy_string(name_str.value()); - if (tmp_name == nullptr) { - goto error; - } - } - - *uri = tmp_uri; - *type = static_cast(object_type); - *name = tmp_name; - - return TILEDB_OK; - -error: - - if (tmp_uri != nullptr) { - std::free(tmp_uri); - } - - if (tmp_name != nullptr) { - std::free(tmp_name); - } - - return TILEDB_OK; -} - capi_return_t tiledb_group_get_member_by_index_v2( tiledb_group_handle_t* group, uint64_t index, @@ -374,33 +322,6 @@ capi_return_t tiledb_group_get_member_by_index_v2( return TILEDB_OK; } -capi_return_t tiledb_group_get_member_by_name( - tiledb_group_handle_t* group, - const char* name, - char** uri, - tiledb_object_t* type) { - ensure_group_is_valid(group); - ensure_name_argument_is_valid(name); - ensure_output_pointer_is_valid(uri); - ensure_output_pointer_is_valid(type); - - LOG_WARN( - "tiledb_group_get_member_by_name is deprecated. Please use " - "tiledb_group_get_member_by_name_v2 instead."); - - auto&& [uri_str, object_type, name_str, ignored_relative] = - group->group().member_by_name(name); - - *uri = copy_string(uri_str); - if (*uri == nullptr) { - return TILEDB_ERR; - } - - *type = static_cast(object_type); - - return TILEDB_OK; -} - capi_return_t tiledb_group_get_member_by_name_v2( tiledb_group_handle_t* group, const char* name, @@ -751,18 +672,6 @@ CAPI_INTERFACE( ctx, group, count); } -CAPI_INTERFACE( - group_get_member_by_index, - tiledb_ctx_t* ctx, - tiledb_group_t* group, - uint64_t index, - char** uri, - tiledb_object_t* type, - char** name) { - return api_entry_context( - ctx, group, index, uri, type, name); -} - CAPI_INTERFACE( group_get_member_by_index_v2, tiledb_ctx_t* ctx, @@ -775,17 +684,6 @@ CAPI_INTERFACE( ctx, group, index, uri, type, name); } -CAPI_INTERFACE( - group_get_member_by_name, - tiledb_ctx_t* ctx, - tiledb_group_t* group, - const char* name, - char** uri, - tiledb_object_t* type) { - return api_entry_context( - ctx, group, name, uri, type); -} - CAPI_INTERFACE( group_get_member_by_name_v2, tiledb_ctx_t* ctx, diff --git a/tiledb/api/c_api/group/group_api_external.h b/tiledb/api/c_api/group/group_api_external.h index e0474dfd5e9..c8bf99ba472 100644 --- a/tiledb/api/c_api/group/group_api_external.h +++ b/tiledb/api/c_api/group/group_api_external.h @@ -422,47 +422,6 @@ TILEDB_EXPORT capi_return_t tiledb_group_remove_member( TILEDB_EXPORT capi_return_t tiledb_group_get_member_count( tiledb_ctx_t* ctx, tiledb_group_t* group, uint64_t* count) TILEDB_NOEXCEPT; -#ifndef TILEDB_REMOVE_DEPRECATIONS -/** - * Get a member of a group by index and details of group. - * Deprecated, use \p tiledb_group_get_member_by_index_v2 instead. - * - * **Example:** - * - * @code{.c} - * tiledb_group_t* group; - * tiledb_group_alloc(ctx, "s3://tiledb_bucket/my_group", &group); - * tiledb_group_open(ctx, group, TILEDB_WRITE); - * tiledb_group_add_member(ctx, group, "s3://tiledb_bucket/my_array"); - * tiledb_group_add_member(ctx, group, "s3://tiledb_bucket/my_group_2"); - * - * tiledb_group_close(ctx, group); - * tiledb_group_open(ctx, group, TILEDB_READ); - * char *uri; - * tiledb_object_t type; - * tiledb_group_get_member_by_index(ctx, group, 0, &uri, &type); - * - * free(uri); - * - * @endcode - * - * @param ctx The TileDB context. - * @param group An group opened in READ mode. - * @param index index of member to fetch - * @param uri URI of member. - * @param type type of member - * @param name name of member. NULL if name was not set - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_DEPRECATED_EXPORT capi_return_t tiledb_group_get_member_by_index( - tiledb_ctx_t* ctx, - tiledb_group_t* group, - uint64_t index, - char** uri, - tiledb_object_t* type, - char** name) TILEDB_NOEXCEPT; -#endif // TILEDB_REMOVE_DEPRECATIONS - /** * Get a member of a group by index and details of group * @@ -502,46 +461,6 @@ TILEDB_EXPORT capi_return_t tiledb_group_get_member_by_index_v2( tiledb_object_t* type, tiledb_string_t** name) TILEDB_NOEXCEPT; -#ifndef TILEDB_REMOVE_DEPRECATIONS -/** - * Get a member of a group by name and details of group. - * Deprecated, use \p tiledb_group_get_member_by_name_v2. - * - * **Example:** - * - * @code{.c} - * tiledb_group_t* group; - * tiledb_group_alloc(ctx, "s3://tiledb_bucket/my_group", &group); - * tiledb_group_open(ctx, group, TILEDB_WRITE); - * tiledb_group_add_member(ctx, group, "s3://tiledb_bucket/my_array", "array1"); - * tiledb_group_add_member(ctx, group, "s3://tiledb_bucket/my_group_2", - * "group2"); - * - * tiledb_group_close(ctx, group); - * tiledb_group_open(ctx, group, TILEDB_READ); - * char *uri; - * tiledb_object_t type; - * tiledb_group_get_member_by_name(ctx, group, "array1", &uri, &type); - * - * free(uri); - * - * @endcode - * - * @param ctx The TileDB context. - * @param group An group opened in READ mode. - * @param name name of member to fetch - * @param uri URI of member - * @param type type of member - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_DEPRECATED_EXPORT capi_return_t tiledb_group_get_member_by_name( - tiledb_ctx_t* ctx, - tiledb_group_t* group, - const char* name, - char** uri, - tiledb_object_t* type) TILEDB_NOEXCEPT; -#endif // TILEDB_REMOVE_DEPRECATIONS - /** * Get a member of a group by name and details of group. * @@ -559,7 +478,7 @@ TILEDB_DEPRECATED_EXPORT capi_return_t tiledb_group_get_member_by_name( * tiledb_group_open(ctx, group, TILEDB_READ); * tilledb_string_t *uri; * tiledb_object_t type; - * tiledb_group_get_member_by_name(ctx, group, "array1", &uri, &type); + * tiledb_group_get_member_by_name_v2(ctx, group, "array1", &uri, &type); * * tiledb_string_free(uri); * diff --git a/tiledb/sm/c_api/tiledb.cc b/tiledb/sm/c_api/tiledb.cc index 75c4b07d479..edd7dd9b447 100644 --- a/tiledb/sm/c_api/tiledb.cc +++ b/tiledb/sm/c_api/tiledb.cc @@ -516,86 +516,6 @@ int32_t tiledb_array_schema_load( return TILEDB_OK; } -int32_t tiledb_array_schema_load_with_key( - tiledb_ctx_t* ctx, - const char* array_uri, - tiledb_encryption_type_t encryption_type, - const void* encryption_key, - uint32_t key_length, - tiledb_array_schema_t** array_schema) { - // Create array schema - *array_schema = new (std::nothrow) tiledb_array_schema_t; - if (*array_schema == nullptr) { - auto st = Status_Error("Failed to allocate TileDB array schema object"); - LOG_STATUS_NO_RETURN_VALUE(st); - save_error(ctx, st); - return TILEDB_OOM; - } - - // Check array name - tiledb::sm::URI uri(array_uri); - if (uri.is_invalid()) { - delete *array_schema; - *array_schema = nullptr; - auto st = Status_Error("Failed to load array schema; Invalid array URI"); - LOG_STATUS_NO_RETURN_VALUE(st); - save_error(ctx, st); - return TILEDB_ERR; - } - - if (uri.is_tiledb()) { - auto& rest_client = ctx->context().rest_client(); - auto&& [st, array_schema_rest] = - rest_client.get_array_schema_from_rest(uri); - if (!st.ok()) { - LOG_STATUS_NO_RETURN_VALUE(st); - save_error(ctx, st); - delete *array_schema; - *array_schema = nullptr; - return TILEDB_ERR; - } - (*array_schema)->array_schema_ = array_schema_rest.value(); - } else { - // Create key - tiledb::sm::EncryptionKey key; - if (SAVE_ERROR_CATCH( - ctx, - key.set_key( - static_cast(encryption_type), - encryption_key, - key_length))) { - delete *array_schema; - *array_schema = nullptr; - return TILEDB_ERR; - } - - // Load URIs from the array directory - optional array_dir; - try { - array_dir.emplace( - ctx->resources(), - uri, - 0, - UINT64_MAX, - tiledb::sm::ArrayDirectoryMode::SCHEMA_ONLY); - } catch (const std::logic_error& le) { - auto st = Status_ArrayDirectoryError(le.what()); - LOG_STATUS_NO_RETURN_VALUE(st); - save_error(ctx, st); - delete *array_schema; - return TILEDB_ERR; - } - - auto tracker = ctx->resources().ephemeral_memory_tracker(); - - // Load latest array schema - auto&& array_schema_latest = - array_dir->load_array_schema_latest(key, tracker); - (*array_schema)->array_schema_ = array_schema_latest; - } - return TILEDB_OK; -} - int32_t tiledb_array_schema_get_array_type( tiledb_ctx_t* ctx, const tiledb_array_schema_t* array_schema, @@ -1108,18 +1028,6 @@ int32_t tiledb_query_get_config( return TILEDB_OK; } -int32_t tiledb_query_set_subarray( - tiledb_ctx_t* ctx, tiledb_query_t* query, const void* subarray_vals) { - // Sanity check - if (sanity_check(ctx, query) == TILEDB_ERR) - return TILEDB_ERR; - - // Set subarray - query->query_->set_subarray(subarray_vals); - - return TILEDB_OK; -} - int32_t tiledb_query_set_subarray_t( tiledb_ctx_t* ctx, tiledb_query_t* query, @@ -1305,19 +1213,6 @@ int32_t tiledb_query_submit(tiledb_ctx_t* ctx, tiledb_query_t* query) { return TILEDB_OK; } -int32_t tiledb_query_submit_async( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - void (*callback)(void*), - void* callback_data) { - // Sanity checks - if (sanity_check(ctx, query) == TILEDB_ERR) - return TILEDB_ERR; - throw_if_not_ok(query->query_->submit_async(callback, callback_data)); - - return TILEDB_OK; -} - int32_t tiledb_query_has_results( tiledb_ctx_t* ctx, tiledb_query_t* query, int32_t* has_results) { // Sanity check @@ -1384,210 +1279,6 @@ int32_t tiledb_query_get_array( return TILEDB_OK; } -int32_t tiledb_query_add_range( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - uint32_t dim_idx, - const void* start, - const void* end, - const void* stride) { - if (sanity_check(ctx, query) == TILEDB_ERR) - return TILEDB_ERR; - - tiledb_subarray_transient_local_t query_subarray(query); - return tiledb_subarray_add_range( - ctx, &query_subarray, dim_idx, start, end, stride); -} - -int32_t tiledb_query_add_point_ranges( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - uint32_t dim_idx, - const void* start, - uint64_t count) { - if (sanity_check(ctx, query) == TILEDB_ERR) - return TILEDB_ERR; - - /* - * WARNING: C API implementation function calling C API function. Error - * handling may not be as expected. - * - * An earlier version of this function was casting away `const`, which may not - * have had the effect intended. This function deserves an audit. - */ - tiledb_subarray_transient_local_t query_subarray(query); - auto local_cfg{tiledb_config_handle_t::make_handle(query->query_->config())}; - tiledb_subarray_set_config(ctx, &query_subarray, local_cfg); - tiledb_config_handle_t::break_handle(local_cfg); - return tiledb_subarray_add_point_ranges( - ctx, &query_subarray, dim_idx, start, count); -} - -int32_t tiledb_query_add_range_by_name( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - const char* dim_name, - const void* start, - const void* end, - const void* stride) { - if (sanity_check(ctx, query) == TILEDB_ERR) - return TILEDB_ERR; - - tiledb_subarray_transient_local_t query_subarray(query); - return tiledb_subarray_add_range_by_name( - ctx, &query_subarray, dim_name, start, end, stride); -} - -int32_t tiledb_query_add_range_var( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - uint32_t dim_idx, - const void* start, - uint64_t start_size, - const void* end, - uint64_t end_size) { - if (sanity_check(ctx, query) == TILEDB_ERR) - return TILEDB_ERR; - - tiledb_subarray_transient_local_t query_subarray(query); - return tiledb_subarray_add_range_var( - ctx, &query_subarray, dim_idx, start, start_size, end, end_size); -} - -int32_t tiledb_query_add_range_var_by_name( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - const char* dim_name, - const void* start, - uint64_t start_size, - const void* end, - uint64_t end_size) { - if (sanity_check(ctx, query) == TILEDB_ERR) - return TILEDB_ERR; - - tiledb_subarray_transient_local_t query_subarray(query); - return tiledb_subarray_add_range_var_by_name( - ctx, &query_subarray, dim_name, start, start_size, end, end_size); -} - -int32_t tiledb_query_get_range_num( - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - uint32_t dim_idx, - uint64_t* range_num) { - if (sanity_check(ctx, query) == TILEDB_ERR) - return TILEDB_ERR; - - tiledb_subarray_transient_local_t query_subarray(query); - return tiledb_subarray_get_range_num( - ctx, &query_subarray, dim_idx, range_num); -} - -int32_t tiledb_query_get_range_num_from_name( - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - const char* dim_name, - uint64_t* range_num) { - if (sanity_check(ctx, query) == TILEDB_ERR) - return TILEDB_ERR; - - tiledb_subarray_transient_local_t query_subarray(query); - return tiledb_subarray_get_range_num_from_name( - ctx, &query_subarray, dim_name, range_num); -} - -int32_t tiledb_query_get_range( - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - uint32_t dim_idx, - uint64_t range_idx, - const void** start, - const void** end, - const void** stride) { - if (sanity_check(ctx, query) == TILEDB_ERR) - return TILEDB_ERR; - - tiledb_subarray_transient_local_t query_subarray(query); - return tiledb_subarray_get_range( - ctx, &query_subarray, dim_idx, range_idx, start, end, stride); -} - -int32_t tiledb_query_get_range_from_name( - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - const char* dim_name, - uint64_t range_idx, - const void** start, - const void** end, - const void** stride) { - if (sanity_check(ctx, query) == TILEDB_ERR) - return TILEDB_ERR; - - tiledb_subarray_transient_local_t query_subarray(query); - return tiledb_subarray_get_range_from_name( - ctx, &query_subarray, dim_name, range_idx, start, end, stride); -} - -int32_t tiledb_query_get_range_var_size( - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - uint32_t dim_idx, - uint64_t range_idx, - uint64_t* start_size, - uint64_t* end_size) { - if (sanity_check(ctx, query) == TILEDB_ERR) - return TILEDB_ERR; - - tiledb_subarray_transient_local_t which_subarray(query); - return tiledb_subarray_get_range_var_size( - ctx, &which_subarray, dim_idx, range_idx, start_size, end_size); -} - -int32_t tiledb_query_get_range_var_size_from_name( - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - const char* dim_name, - uint64_t range_idx, - uint64_t* start_size, - uint64_t* end_size) { - if (sanity_check(ctx, query) == TILEDB_ERR) - return TILEDB_ERR; - - tiledb_subarray_transient_local_t query_subarray(query); - return tiledb_subarray_get_range_var_size_from_name( - ctx, &query_subarray, dim_name, range_idx, start_size, end_size); -} - -int32_t tiledb_query_get_range_var( - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - uint32_t dim_idx, - uint64_t range_idx, - void* start, - void* end) { - if (sanity_check(ctx, query) == TILEDB_ERR) - return TILEDB_ERR; - - tiledb_subarray_transient_local_t query_subarray(query); - return tiledb_subarray_get_range_var( - ctx, &query_subarray, dim_idx, range_idx, start, end); -} - -int32_t tiledb_query_get_range_var_from_name( - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - const char* dim_name, - uint64_t range_idx, - void* start, - void* end) { - if (sanity_check(ctx, query) == TILEDB_ERR) - return TILEDB_ERR; - - tiledb_subarray_transient_local_t query_subarray(query); - return tiledb_subarray_get_range_var_from_name( - ctx, &query_subarray, dim_name, range_idx, start, end); -} - int32_t tiledb_query_get_est_result_size( tiledb_ctx_t* ctx, const tiledb_query_t* query, @@ -2331,49 +2022,6 @@ int32_t tiledb_array_delete(tiledb_ctx_t* ctx, const char* uri) { return TILEDB_OK; } -int32_t tiledb_array_delete_array( - tiledb_ctx_t* ctx, tiledb_array_t* array, const char* uri) { - if (sanity_check(ctx, array) == TILEDB_ERR) - return TILEDB_ERR; - - try { - array->array_->delete_array(tiledb::sm::URI(uri)); - } catch (std::exception& e) { - auto st = Status_ArrayError(e.what()); - LOG_STATUS_NO_RETURN_VALUE(st); - save_error(ctx, st); - return TILEDB_ERR; - } - - return TILEDB_OK; -} - -int32_t tiledb_array_delete_fragments( - tiledb_ctx_t* ctx, - tiledb_array_t* array, - const char* uri, - uint64_t timestamp_start, - uint64_t timestamp_end) { - if (sanity_check(ctx, array) == TILEDB_ERR) - return TILEDB_ERR; - - LOG_WARN( - "tiledb_array_delete_fragments is deprecated. Please use " - "tiledb_array_delete_fragments_v2 instead."); - - try { - array->array_->delete_fragments( - tiledb::sm::URI(uri), timestamp_start, timestamp_end); - } catch (std::exception& e) { - auto st = Status_ArrayError(e.what()); - LOG_STATUS_NO_RETURN_VALUE(st); - save_error(ctx, st); - return TILEDB_ERR; - } - - return TILEDB_OK; -} - capi_return_t tiledb_array_delete_fragments_v2( tiledb_ctx_t* ctx, const char* uri_str, @@ -2583,98 +2231,39 @@ int32_t tiledb_array_get_schema( if (!st.ok()) { LOG_STATUS_NO_RETURN_VALUE(st); save_error(ctx, st); - delete *array_schema; - *array_schema = nullptr; - return TILEDB_ERR; - } - (*array_schema)->array_schema_ = array_schema_get.value(); - - return TILEDB_OK; -} - -int32_t tiledb_array_get_query_type( - tiledb_ctx_t* ctx, tiledb_array_t* array, tiledb_query_type_t* query_type) { - // Sanity checks - if (sanity_check(ctx, array) == TILEDB_ERR) { - return TILEDB_ERR; - } - - // Get query_type - tiledb::sm::QueryType type; - try { - type = array->array_->get_query_type(); - } catch (StatusException& e) { - return TILEDB_ERR; - } - - *query_type = static_cast(type); - - return TILEDB_OK; -} - -int32_t tiledb_array_create( - tiledb_ctx_t* ctx, - const char* array_uri, - const tiledb_array_schema_t* array_schema) { - // Sanity checks - if (sanity_check(ctx, array_schema) == TILEDB_ERR) - return TILEDB_ERR; - - // Check array name - tiledb::sm::URI uri(array_uri); - if (uri.is_invalid()) { - auto st = Status_Error("Failed to create array; Invalid array URI"); - LOG_STATUS_NO_RETURN_VALUE(st); - save_error(ctx, st); - return TILEDB_ERR; - } - - if (uri.is_tiledb()) { - auto& rest_client = ctx->context().rest_client(); - throw_if_not_ok(rest_client.post_array_schema_to_rest( - uri, *(array_schema->array_schema_.get()))); - } else { - // Create key - tiledb::sm::EncryptionKey key; - throw_if_not_ok( - key.set_key(tiledb::sm::EncryptionType::NO_ENCRYPTION, nullptr, 0)); - // Create the array - tiledb::sm::Array::create( - ctx->resources(), uri, array_schema->array_schema_, key); - - // Create any dimension labels in the array. - for (tiledb::sm::ArraySchema::dimension_label_size_type ilabel{0}; - ilabel < array_schema->array_schema_->dim_label_num(); - ++ilabel) { - // Get dimension label information and define URI and name. - const auto& dim_label_ref = - array_schema->array_schema_->dimension_label(ilabel); - if (dim_label_ref.is_external()) - continue; - if (!dim_label_ref.has_schema()) { - throw StatusException( - Status_Error("Failed to create array. Dimension labels that are " - "not external must have a schema.")); - } + delete *array_schema; + *array_schema = nullptr; + return TILEDB_ERR; + } + (*array_schema)->array_schema_ = array_schema_get.value(); - // Create the dimension label array with the same key. - tiledb::sm::Array::create( - ctx->resources(), - dim_label_ref.uri(uri), - dim_label_ref.schema(), - key); - } + return TILEDB_OK; +} + +int32_t tiledb_array_get_query_type( + tiledb_ctx_t* ctx, tiledb_array_t* array, tiledb_query_type_t* query_type) { + // Sanity checks + if (sanity_check(ctx, array) == TILEDB_ERR) { + return TILEDB_ERR; + } + + // Get query_type + tiledb::sm::QueryType type; + try { + type = array->array_->get_query_type(); + } catch (StatusException& e) { + return TILEDB_ERR; } + + *query_type = static_cast(type); + return TILEDB_OK; } -int32_t tiledb_array_create_with_key( +int32_t tiledb_array_create( tiledb_ctx_t* ctx, const char* array_uri, - const tiledb_array_schema_t* array_schema, - tiledb_encryption_type_t encryption_type, - const void* encryption_key, - uint32_t key_length) { + const tiledb_array_schema_t* array_schema) { // Sanity checks if (sanity_check(ctx, array_schema) == TILEDB_ERR) return TILEDB_ERR; @@ -2689,26 +2278,14 @@ int32_t tiledb_array_create_with_key( } if (uri.is_tiledb()) { - // Check unencrypted - if (encryption_type != TILEDB_NO_ENCRYPTION) { - auto st = Status_Error( - "Failed to create array; encrypted remote arrays are not " - "supported."); - LOG_STATUS_NO_RETURN_VALUE(st); - save_error(ctx, st); - return TILEDB_ERR; - } auto& rest_client = ctx->context().rest_client(); throw_if_not_ok(rest_client.post_array_schema_to_rest( uri, *(array_schema->array_schema_.get()))); } else { // Create key tiledb::sm::EncryptionKey key; - throw_if_not_ok(key.set_key( - static_cast(encryption_type), - encryption_key, - key_length)); - + throw_if_not_ok( + key.set_key(tiledb::sm::EncryptionType::NO_ENCRYPTION, nullptr, 0)); // Create the array tiledb::sm::Array::create( ctx->resources(), uri, array_schema->array_schema_, key); @@ -2753,27 +2330,6 @@ int32_t tiledb_array_consolidate( return TILEDB_OK; } -int32_t tiledb_array_consolidate_with_key( - tiledb_ctx_t* ctx, - const char* array_uri, - tiledb_encryption_type_t encryption_type, - const void* encryption_key, - uint32_t key_length, - tiledb_config_t* config) { - // Sanity checks - - tiledb::sm::Consolidator::array_consolidate( - ctx->resources(), - array_uri, - static_cast(encryption_type), - encryption_key, - key_length, - (config == nullptr) ? ctx->config() : config->config(), - ctx->storage_manager()); - - return TILEDB_OK; -} - int32_t tiledb_array_consolidate_fragments( tiledb_ctx_t* ctx, const char* array_uri, @@ -4446,27 +4002,6 @@ capi_return_t tiledb_handle_consolidation_plan_request( return TILEDB_OK; } -/* ****************************** */ -/* C++ API */ -/* ****************************** */ -namespace impl { -int32_t tiledb_query_submit_async_func( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - void* callback_func, - void* callback_data) { - if (sanity_check(ctx, query) == TILEDB_ERR || callback_func == nullptr) - return TILEDB_ERR; - - std::function callback = - *reinterpret_cast*>(callback_func); - - throw_if_not_ok(query->query_->submit_async(callback, callback_data)); - - return TILEDB_OK; -} -} // namespace impl - /* ****************************** */ /* FRAGMENT INFO */ /* ****************************** */ @@ -4563,25 +4098,6 @@ int32_t tiledb_fragment_info_load( return TILEDB_OK; } -int32_t tiledb_fragment_info_get_fragment_name( - tiledb_ctx_t* ctx, - tiledb_fragment_info_t* fragment_info, - uint32_t fid, - const char** name) { - if (sanity_check(ctx, fragment_info) == TILEDB_ERR) - return TILEDB_ERR; - - LOG_WARN( - "tiledb_fragment_info_get_fragment_name is deprecated. Please use " - "tiledb_fragment_info_get_fragment_name_v2 instead."); - // This will leak the string but as a temporary solution until - // this deprecated function is removed. - *name = (new std::string(fragment_info->fragment_info_->fragment_name(fid))) - ->c_str(); - - return TILEDB_OK; -} - int32_t tiledb_fragment_info_get_fragment_name_v2( tiledb_ctx_t* ctx, tiledb_fragment_info_t* fragment_info, @@ -5483,23 +4999,6 @@ CAPI_INTERFACE( ctx, array_uri, array_schema); } -CAPI_INTERFACE( - array_schema_load_with_key, - tiledb_ctx_t* ctx, - const char* array_uri, - tiledb_encryption_type_t encryption_type, - const void* encryption_key, - uint32_t key_length, - tiledb_array_schema_t** array_schema) { - return api_entry( - ctx, - array_uri, - encryption_type, - encryption_key, - key_length, - array_schema); -} - CAPI_INTERFACE( array_schema_get_array_type, tiledb_ctx_t* ctx, @@ -5770,15 +5269,6 @@ CAPI_INTERFACE( return api_entry(ctx, query, config); } -CAPI_INTERFACE( - query_set_subarray, - tiledb_ctx_t* ctx, - tiledb_query_t* query, - const void* subarray_vals) { - return api_entry( - ctx, query, subarray_vals); -} - CAPI_INTERFACE( query_set_subarray_t, tiledb_ctx_t* ctx, @@ -5887,16 +5377,6 @@ CAPI_INTERFACE(query_submit, tiledb_ctx_t* ctx, tiledb_query_t* query) { return api_entry(ctx, query); } -CAPI_INTERFACE( - query_submit_async, - tiledb_ctx_t* ctx, - tiledb_query_t* query, - void (*callback)(void*), - void* callback_data) { - return api_entry( - ctx, query, callback, callback_data); -} - CAPI_INTERFACE( query_has_results, tiledb_ctx_t* ctx, @@ -5939,161 +5419,6 @@ CAPI_INTERFACE( return api_entry(ctx, query, array); } -CAPI_INTERFACE( - query_add_range, - tiledb_ctx_t* ctx, - tiledb_query_t* query, - uint32_t dim_idx, - const void* start, - const void* end, - const void* stride) { - return api_entry( - ctx, query, dim_idx, start, end, stride); -} - -CAPI_INTERFACE( - query_add_point_ranges, - tiledb_ctx_t* ctx, - tiledb_query_t* query, - uint32_t dim_idx, - const void* start, - uint64_t count) { - return api_entry( - ctx, query, dim_idx, start, count); -} - -CAPI_INTERFACE( - query_add_range_by_name, - tiledb_ctx_t* ctx, - tiledb_query_t* query, - const char* dim_name, - const void* start, - const void* end, - const void* stride) { - return api_entry( - ctx, query, dim_name, start, end, stride); -} - -CAPI_INTERFACE( - query_add_range_var, - tiledb_ctx_t* ctx, - tiledb_query_t* query, - uint32_t dim_idx, - const void* start, - uint64_t start_size, - const void* end, - uint64_t end_size) { - return api_entry( - ctx, query, dim_idx, start, start_size, end, end_size); -} - -CAPI_INTERFACE( - query_add_range_var_by_name, - tiledb_ctx_t* ctx, - tiledb_query_t* query, - const char* dim_name, - const void* start, - uint64_t start_size, - const void* end, - uint64_t end_size) { - return api_entry( - ctx, query, dim_name, start, start_size, end, end_size); -} - -CAPI_INTERFACE( - query_get_range_num, - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - uint32_t dim_idx, - uint64_t* range_num) { - return api_entry( - ctx, query, dim_idx, range_num); -} - -CAPI_INTERFACE( - query_get_range_num_from_name, - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - const char* dim_name, - uint64_t* range_num) { - return api_entry( - ctx, query, dim_name, range_num); -} - -CAPI_INTERFACE( - query_get_range, - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - uint32_t dim_idx, - uint64_t range_idx, - const void** start, - const void** end, - const void** stride) { - return api_entry( - ctx, query, dim_idx, range_idx, start, end, stride); -} - -CAPI_INTERFACE( - query_get_range_from_name, - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - const char* dim_name, - uint64_t range_idx, - const void** start, - const void** end, - const void** stride) { - return api_entry( - ctx, query, dim_name, range_idx, start, end, stride); -} - -CAPI_INTERFACE( - query_get_range_var_size, - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - uint32_t dim_idx, - uint64_t range_idx, - uint64_t* start_size, - uint64_t* end_size) { - return api_entry( - ctx, query, dim_idx, range_idx, start_size, end_size); -} - -CAPI_INTERFACE( - query_get_range_var_size_from_name, - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - const char* dim_name, - uint64_t range_idx, - uint64_t* start_size, - uint64_t* end_size) { - return api_entry( - ctx, query, dim_name, range_idx, start_size, end_size); -} - -CAPI_INTERFACE( - query_get_range_var, - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - uint32_t dim_idx, - uint64_t range_idx, - void* start, - void* end) { - return api_entry( - ctx, query, dim_idx, range_idx, start, end); -} - -CAPI_INTERFACE( - query_get_range_var_from_name, - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - const char* dim_name, - uint64_t range_idx, - void* start, - void* end) { - return api_entry( - ctx, query, dim_name, range_idx, start, end); -} - CAPI_INTERFACE( query_get_est_result_size, tiledb_ctx_t* ctx, @@ -6521,25 +5846,6 @@ CAPI_INTERFACE(array_delete, tiledb_ctx_t* ctx, const char* uri) { return api_entry(ctx, uri); } -CAPI_INTERFACE( - array_delete_array, - tiledb_ctx_t* ctx, - tiledb_array_t* array, - const char* uri) { - return api_entry(ctx, array, uri); -} - -CAPI_INTERFACE( - array_delete_fragments, - tiledb_ctx_t* ctx, - tiledb_array_t* array, - const char* uri, - uint64_t timestamp_start, - uint64_t timestamp_end) { - return api_entry( - ctx, array, uri, timestamp_start, timestamp_end); -} - CAPI_INTERFACE( array_delete_fragments_v2, tiledb_ctx_t* ctx, @@ -6628,23 +5934,6 @@ CAPI_INTERFACE( ctx, array_uri, array_schema); } -CAPI_INTERFACE( - array_create_with_key, - tiledb_ctx_t* ctx, - const char* array_uri, - const tiledb_array_schema_t* array_schema, - tiledb_encryption_type_t encryption_type, - const void* encryption_key, - uint32_t key_length) { - return api_entry( - ctx, - array_uri, - array_schema, - encryption_type, - encryption_key, - key_length); -} - CAPI_INTERFACE( array_consolidate, tiledb_ctx_t* ctx, @@ -6654,18 +5943,6 @@ CAPI_INTERFACE( ctx, array_uri, config); } -CAPI_INTERFACE( - array_consolidate_with_key, - tiledb_ctx_t* ctx, - const char* array_uri, - tiledb_encryption_type_t encryption_type, - const void* encryption_key, - uint32_t key_length, - tiledb_config_t* config) { - return api_entry( - ctx, array_uri, encryption_type, encryption_key, key_length, config); -} - CAPI_INTERFACE( array_consolidate_fragments, tiledb_ctx_t* ctx, @@ -7370,20 +6647,6 @@ CAPI_INTERFACE( ctx, array, serialization_type, request, response); } -#ifndef TILEDB_REMOVE_DEPRECATIONS -/* ****************************** */ -/* C++ API */ -/* ****************************** */ -int32_t tiledb::impl::tiledb_query_submit_async_func( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - void* callback_func, - void* callback_data) noexcept { - return api_entry( - ctx, query, callback_func, callback_data); -} -#endif - /* ****************************** */ /* FRAGMENT INFO */ /* ****************************** */ @@ -7427,16 +6690,6 @@ CAPI_INTERFACE( return api_entry(ctx, fragment_info); } -CAPI_INTERFACE( - fragment_info_get_fragment_name, - tiledb_ctx_t* ctx, - tiledb_fragment_info_t* fragment_info, - uint32_t fid, - const char** name) { - return api_entry( - ctx, fragment_info, fid, name); -} - CAPI_INTERFACE( fragment_info_get_fragment_name_v2, tiledb_ctx_t* ctx, diff --git a/tiledb/sm/c_api/tiledb.h b/tiledb/sm/c_api/tiledb.h index 03eb67d1a84..5ba0b59578c 100644 --- a/tiledb/sm/c_api/tiledb.h +++ b/tiledb/sm/c_api/tiledb.h @@ -2804,27 +2804,6 @@ TILEDB_EXPORT int32_t tiledb_array_create( TILEDB_EXPORT int32_t tiledb_array_delete(tiledb_ctx_t* ctx, const char* uri) TILEDB_NOEXCEPT; -#ifndef TILEDB_REMOVE_DEPRECATIONS -/** - * Note: This API is deprecated and replaced with tiledb_array_delete (above). - * - * Deletes all written array data. - * - * **Example:** - * - * @code{.c} - * tiledb_array_delete_array(ctx, array, "hdfs:///temp/my_array"); - * @endcode - * - * @param ctx The TileDB context. - * @param array The array to delete the data from. - * @param uri The Array's URI. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_DEPRECATED_EXPORT int32_t tiledb_array_delete_array( - tiledb_ctx_t* ctx, tiledb_array_t* array, const char* uri) TILEDB_NOEXCEPT; -#endif // TILEDB_REMOVE_DEPRECATIONS - /** * Upgrades an array to the latest format version. * @@ -3676,7 +3655,7 @@ TILEDB_EXPORT int32_t tiledb_fragment_info_load( * * @code{.c} * tiledb_string_t* name; - * tiledb_fragment_info_get_fragment_name(ctx, fragment_info, 1, &name); + * tiledb_fragment_info_get_fragment_name_v2(ctx, fragment_info, 1, &name); * // Remember to free the string with tiledb_string_free when you are done with * // it. * @endcode diff --git a/tiledb/sm/c_api/tiledb_deprecated.h b/tiledb/sm/c_api/tiledb_deprecated.h index f7585137819..54e78b0446b 100644 --- a/tiledb/sm/c_api/tiledb_deprecated.h +++ b/tiledb/sm/c_api/tiledb_deprecated.h @@ -40,589 +40,7 @@ extern "C" { #endif -/** - * Retrieves the schema of an encrypted array from the disk, creating an array - * schema struct. - * - * **Example:** - * - * @code{.c} - * // Load AES-256 key from disk, environment variable, etc. - * uint8_t key[32] = ...; - * tiledb_array_schema_t* array_schema; - * tiledb_array_schema_load_with_key( - * ctx, "s3://tiledb_bucket/my_array", TILEDB_AES_256_GCM, - * key, sizeof(key), &array_schema); - * // Make sure to free the array schema in the end - * @endcode - * - * @param ctx The TileDB context. - * @param array_uri The array whose schema will be retrieved. - * @param encryption_type The encryption type to use. - * @param encryption_key The encryption key to use. - * @param key_length Length in bytes of the encryption key. - * @param array_schema The array schema to be retrieved, or `NULL` upon error. - * @return `TILEDB_OK` for success and `TILEDB_OOM` or `TILEDB_ERR` for error. - */ -TILEDB_DEPRECATED_EXPORT int32_t tiledb_array_schema_load_with_key( - tiledb_ctx_t* ctx, - const char* array_uri, - tiledb_encryption_type_t encryption_type, - const void* encryption_key, - uint32_t key_length, - tiledb_array_schema_t** array_schema) TILEDB_NOEXCEPT; - -/** - * Indicates that the query will write or read a subarray, and provides - * the appropriate information. - * - * **Example:** - * - * The following sets a 2D subarray [0,10], [20, 30] to the query. - * - * @code{.c} - * uint64_t subarray[] = { 0, 10, 20, 30}; - * tiledb_query_set_subarray(ctx, query, subarray); - * @endcode - * - * @param ctx The TileDB context. - * @param query The TileDB query. - * @param subarray The subarray in which the array read/write will be - * constrained on. It should be a sequence of [low, high] pairs (one - * pair per dimension). For the case of writes, this is meaningful only - * for dense arrays. Note that `subarray` must have the same type as the - * domain. - * @return `TILEDB_OK` for success or `TILEDB_ERR` for error. - * - * @note This will error if the query is already initialized. - * - * @note This function will error for writes to sparse arrays. - */ -TILEDB_DEPRECATED_EXPORT int32_t tiledb_query_set_subarray( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - const void* subarray) TILEDB_NOEXCEPT; - -/** - * Submits a TileDB query in asynchronous mode. - * - * **Examples:** - * - * Submit without a callback. - * - * @code{.c} - * tiledb_query_submit_async(ctx, query, NULL, NULL); - * @endcode - * - * Submit with a callback function `print` that takes as input message - * `msg` and prints it upon completion of the query. - * - * @code{.c} - * const char* msg = "Query completed"; - * tiledb_query_submit_async(ctx, &query, foo, msg); - * @endcode - * - * @param ctx The TileDB context. - * @param query The query to be submitted. - * @param callback The function to be called when the query completes. - * @param callback_data The data to be passed to the \p callback function. - * @return `TILEDB_OK` for success and `TILEDB_OOM` or `TILEDB_ERR` for error. - * - * @note `tiledb_query_finalize` must be invoked after finish writing in - * global layout (via repeated invocations of `tiledb_query_submit`), - * in order to flush any internal state. - * - * @note For the case of reads, if the returned status is `TILEDB_INCOMPLETE`, - * TileDB could not fit the entire result in the user's buffers. In this - * case, the user should consume the read results (if any), optionally - * reset the buffers with `tiledb_query_set_buffer`, and then resubmit the - * query until the status becomes `TILEDB_COMPLETED`. If all buffer sizes - * after the termination of this function become 0, then this means that - * **no** useful data was read into the buffers, implying that larger - * buffers are needed for the query to proceed. In this case, the users - * must reallocate their buffers (increasing their size), reset the buffers - * with `tiledb_query_set_buffer`, and resubmit the query. - * - * @note \p callback will be executed in a thread managed by TileDB's internal - * thread pool. To allow TileDB to reuse the thread and avoid starving the - * thread pool, long-running callbacks should be dispatched to another - * thread. - */ -TILEDB_DEPRECATED_EXPORT int32_t tiledb_query_submit_async( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - void (*callback)(void*), - void* callback_data) TILEDB_NOEXCEPT; - -/** - * Adds a 1D range along a subarray dimension index, which is in the form - * (start, end, stride). The datatype of the range components - * must be the same as the type of the domain of the array in the query. - * - * **Example:** - * - * @code{.c} - * uint32_t dim_idx = 2; - * int64_t start = 10; - * int64_t end = 20; - * tiledb_query_add_range(ctx, query, dim_idx, &start, &end, nullptr); - * @endcode - * - * @param ctx The TileDB context. - * @param query The query to add the range to. - * @param dim_idx The index of the dimension to add the range to. - * @param start The range start. - * @param end The range end. - * @param stride The range stride. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - * - * @note The stride is currently unsupported. Use `nullptr` as the - * stride argument. - */ - -TILEDB_DEPRECATED_EXPORT int32_t tiledb_query_add_range( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - uint32_t dim_idx, - const void* start, - const void* end, - const void* stride) TILEDB_NOEXCEPT; - -/** - * Adds a 1D range along a subarray dimension name, which is in the form - * (start, end, stride). The datatype of the range components - * must be the same as the type of the domain of the array in the query. - * - * **Example:** - * - * @code{.c} - * char* dim_name = "rows"; - * int64_t start = 10; - * int64_t end = 20; - * tiledb_query_add_range_by_name(ctx, query, dim_name, &start, &end, nullptr); - * @endcode - * - * @param ctx The TileDB context. - * @param query The query to add the range to. - * @param dim_name The name of the dimension to add the range to. - * @param start The range start. - * @param end The range end. - * @param stride The range stride. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - * - * @note The stride is currently unsupported. Use `nullptr` as the - * stride argument. - */ -TILEDB_DEPRECATED_EXPORT int32_t tiledb_query_add_range_by_name( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - const char* dim_name, - const void* start, - const void* end, - const void* stride) TILEDB_NOEXCEPT; - -/** - * Adds a 1D variable-sized range along a subarray dimension index, which is in - * the form (start, end). Applicable only to variable-sized dimensions. - * - * **Example:** - * - * @code{.c} - * uint32_t dim_idx = 2; - * char start[] = "a"; - * char end[] = "bb"; - * tiledb_query_add_range_var(ctx, query, dim_idx, start, 1, end, 2); - * @endcode - * - * @param ctx The TileDB context. - * @param query The query to add the range to. - * @param dim_idx The index of the dimension to add the range to. - * @param start The range start. - * @param start_size The size of the range start in bytes. - * @param end The range end. - * @param end_size The size of the range end in bytes. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_DEPRECATED_EXPORT int32_t tiledb_query_add_range_var( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - uint32_t dim_idx, - const void* start, - uint64_t start_size, - const void* end, - uint64_t end_size) TILEDB_NOEXCEPT; - -/** - * Adds a 1D variable-sized range along a subarray dimension name, which is in - * the form (start, end). Applicable only to variable-sized dimensions. - * - * **Example:** - * - * @code{.c} - * char* dim_name = "rows"; - * char start[] = "a"; - * char end[] = "bb"; - * tiledb_query_add_range_var_by_name(ctx, query, dim_name, start, 1, end, 2); - * @endcode - * - * @param ctx The TileDB context. - * @param query The query to add the range to. - * @param dim_name The name of the dimension to add the range to. - * @param start The range start. - * @param start_size The size of the range start in bytes. - * @param end The range end. - * @param end_size The size of the range end in bytes. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_DEPRECATED_EXPORT int32_t tiledb_query_add_range_var_by_name( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - const char* dim_name, - const void* start, - uint64_t start_size, - const void* end, - uint64_t end_size) TILEDB_NOEXCEPT; - -/** - * Retrieves the number of ranges of the query subarray along a given dimension - * index. - * - * **Example:** - * - * @code{.c} - * uint64_t range_num; - * tiledb_query_get_range_num(ctx, query, dim_idx, &range_num); - * @endcode - * - * @param ctx The TileDB context - * @param query The query. - * @param dim_idx The index of the dimension whose range number to retrieve. - * @param range_num The number of ranges to retrieve. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_DEPRECATED_EXPORT int32_t tiledb_query_get_range_num( - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - uint32_t dim_idx, - uint64_t* range_num) TILEDB_NOEXCEPT; - -/** - * Retrieves the number of ranges of the query subarray along a given dimension - * name. - * - * **Example:** - * - * @code{.c} - * uint64_t range_num; - * tiledb_query_get_range_num_from_name(ctx, query, dim_name, &range_num); - * @endcode - * - * @param ctx The TileDB context - * @param query The query. - * @param dim_name The name of the dimension whose range number to retrieve. - * @param range_num The number of ranges to retrieve. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_DEPRECATED_EXPORT int32_t tiledb_query_get_range_num_from_name( - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - const char* dim_name, - uint64_t* range_num) TILEDB_NOEXCEPT; - -/** - * Retrieves a specific range of the query subarray along a given dimension - * index. - * - * **Example:** - * - * @code{.c} - * const void* start; - * const void* end; - * const void* stride; - * tiledb_query_get_range( - * ctx, query, dim_idx, range_idx, &start, &end, &stride); - * @endcode - * - * @param ctx The TileDB context - * @param query The query. - * @param dim_idx The index of the dimension to retrieve the range from. - * @param range_idx The index of the range to retrieve. - * @param start The range start to retrieve. - * @param end The range end to retrieve. - * @param stride The range stride to retrieve. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_DEPRECATED_EXPORT int32_t tiledb_query_get_range( - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - uint32_t dim_idx, - uint64_t range_idx, - const void** start, - const void** end, - const void** stride) TILEDB_NOEXCEPT; - -/** - * Retrieves a specific range of the query subarray along a given dimension - * name. - * - * **Example:** - * - * @code{.c} - * const void* start; - * const void* end; - * const void* stride; - * tiledb_query_get_range_from_name( - * ctx, query, dim_name, range_idx, &start, &end, &stride); - * @endcode - * - * @param ctx The TileDB context - * @param query The query. - * @param dim_name The name of the dimension to retrieve the range from. - * @param range_idx The index of the range to retrieve. - * @param start The range start to retrieve. - * @param end The range end to retrieve. - * @param stride The range stride to retrieve. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_DEPRECATED_EXPORT int32_t tiledb_query_get_range_from_name( - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - const char* dim_name, - uint64_t range_idx, - const void** start, - const void** end, - const void** stride) TILEDB_NOEXCEPT; - -/** - * Retrieves a range's start and end size for a given variable-length - * dimension index at a given range index. - * - * **Example:** - * - * @code{.c} - * uint64_t start_size; - * uint64_t end_size; - * tiledb_query_get_range_var_size( - * ctx, query, dim_idx, range_idx, &start_size, &end_size); - * @endcode - * - * @param ctx The TileDB context - * @param query The query. - * @param dim_idx The index of the dimension to retrieve the range from. - * @param range_idx The index of the range to retrieve. - * @param start_size range start size in bytes - * @param end_size range end size in bytes - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_DEPRECATED_EXPORT int32_t tiledb_query_get_range_var_size( - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - uint32_t dim_idx, - uint64_t range_idx, - uint64_t* start_size, - uint64_t* end_size) TILEDB_NOEXCEPT; - -/** - * Retrieves a range's start and end size for a given variable-length - * dimension name at a given range index. - * - * **Example:** - * - * @code{.c} - * uint64_t start_size; - * uint64_t end_size; - * tiledb_query_get_range_var_size_from_name( - * ctx, query, dim_name, range_idx, &start_size, &end_size); - * @endcode - * - * @param ctx The TileDB context - * @param query The query. - * @param dim_name The name of the dimension to retrieve the range from. - * @param range_idx The index of the range to retrieve. - * @param start_size range start size in bytes - * @param end_size range end size in bytes - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_DEPRECATED_EXPORT int32_t tiledb_query_get_range_var_size_from_name( - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - const char* dim_name, - uint64_t range_idx, - uint64_t* start_size, - uint64_t* end_size) TILEDB_NOEXCEPT; - -/** - * Retrieves a specific range of the query subarray along a given - * variable-length dimension index. - * - * **Example:** - * - * @code{.c} - * const void* start; - * const void* end; - * tiledb_query_get_range_var( - * ctx, query, dim_idx, range_idx, &start, &end); - * @endcode - * - * @param ctx The TileDB context - * @param query The query. - * @param dim_idx The index of the dimension to retrieve the range from. - * @param range_idx The index of the range to retrieve. - * @param start The range start to retrieve. - * @param end The range end to retrieve. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_DEPRECATED_EXPORT int32_t tiledb_query_get_range_var( - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - uint32_t dim_idx, - uint64_t range_idx, - void* start, - void* end) TILEDB_NOEXCEPT; - -/** - * Retrieves a specific range of the query subarray along a given - * variable-length dimension name. - * - * **Example:** - * - * @code{.c} - * const void* start; - * const void* end; - * tiledb_query_get_range_var_from_name( - * ctx, query, dim_name, range_idx, &start, &end); - * @endcode - * - * @param ctx The TileDB context - * @param query The query. - * @param dim_name The name of the dimension to retrieve the range from. - * @param range_idx The index of the range to retrieve. - * @param start The range start to retrieve. - * @param end The range end to retrieve. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_DEPRECATED_EXPORT int32_t tiledb_query_get_range_var_from_name( - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - const char* dim_name, - uint64_t range_idx, - void* start, - void* end) TILEDB_NOEXCEPT; - -/** - * Deletes array fragments written between the input timestamps. - * - * **Example:** - * - * @code{.c} - * tiledb_array_delete_fragments( - * ctx, array, "hdfs:///temp/my_array", 0, UINT64_MAX); - * @endcode - * - * @param ctx The TileDB context. - * @param array The array to delete the fragments from. - * @param uri The URI of the fragments' parent Array. - * @param timestamp_start The epoch timestamp in milliseconds. - * @param timestamp_end The epoch timestamp in milliseconds. Use UINT64_MAX for - * the current timestamp. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - * - * @note This function was deprecated in release 2.18 in favor of - * tiledb_array_delete_fragments_v2. - */ -TILEDB_DEPRECATED_EXPORT int32_t tiledb_array_delete_fragments( - tiledb_ctx_t* ctx, - tiledb_array_t* array, - const char* uri, - uint64_t timestamp_start, - uint64_t timestamp_end) TILEDB_NOEXCEPT; - -/** - * Creates a new encrypted TileDB array given an input schema. - * - * Encrypted arrays can only be created through this function. - * - * **Example:** - * - * @code{.c} - * uint8_t key[32] = ...; - * tiledb_array_create_with_key( - * ctx, "hdfs:///tiledb_arrays/my_array", array_schema, - * TILEDB_AES_256_GCM, key, sizeof(key)); - * @endcode - * - * @param ctx The TileDB context. - * @param array_uri The array name. - * @param array_schema The array schema. - * @param encryption_type The encryption type to use. - * @param encryption_key The encryption key to use. - * @param key_length Length in bytes of the encryption key. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_DEPRECATED_EXPORT int32_t tiledb_array_create_with_key( - tiledb_ctx_t* ctx, - const char* array_uri, - const tiledb_array_schema_t* array_schema, - tiledb_encryption_type_t encryption_type, - const void* encryption_key, - uint32_t key_length) TILEDB_NOEXCEPT; - -/** - * Depending on the consoliation mode in the config, consolidates either the - * fragment files, fragment metadata files, or array metadata files into a - * single file. - * - * **Example:** - * - * @code{.c} - * uint8_t key[32] = ...; - * tiledb_array_consolidate_with_key( - * ctx, "hdfs:///tiledb_arrays/my_array", - * TILEDB_AES_256_GCM, key, sizeof(key), nullptr); - * @endcode - * - * @param ctx The TileDB context. - * @param array_uri The name of the TileDB array to be consolidated. - * @param encryption_type The encryption type to use. - * @param encryption_key The encryption key to use. - * @param key_length Length in bytes of the encryption key. - * @param config Configuration parameters for the consolidation - * (`nullptr` means default, which will use the config from `ctx`). - * The `sm.consolidation.mode` parameter determines which type of - * consolidation to perform. - * - * @return `TILEDB_OK` on success, and `TILEDB_ERR` on error. - */ -TILEDB_DEPRECATED_EXPORT int32_t tiledb_array_consolidate_with_key( - tiledb_ctx_t* ctx, - const char* array_uri, - tiledb_encryption_type_t encryption_type, - const void* encryption_key, - uint32_t key_length, - tiledb_config_t* config) TILEDB_NOEXCEPT; - -/** - * Gets the name of a fragment. Deprecated, use - * \p tiledb_fragment_info_get_fragment_name_v2 instead. - * - * **Example:** - * - * @code{.c} - * const char* name; - * tiledb_fragment_info_get_fragment_name(ctx, fragment_info, 1, &name); - * @endcode - * - * @param ctx The TileDB context. - * @param fragment_info The fragment info object. - * @param fid The index of the fragment of interest. - * @param name The fragment name to be retrieved. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_DEPRECATED_EXPORT int32_t tiledb_fragment_info_get_fragment_name( - tiledb_ctx_t* ctx, - tiledb_fragment_info_t* fragment_info, - uint32_t fid, - const char** name) TILEDB_NOEXCEPT; +// No deprecated APIs are declared at the moment. #ifdef __cplusplus } diff --git a/tiledb/sm/c_api/tiledb_experimental.h b/tiledb/sm/c_api/tiledb_experimental.h index 691ce1f5586..c95ee75d1be 100644 --- a/tiledb/sm/c_api/tiledb_experimental.h +++ b/tiledb/sm/c_api/tiledb_experimental.h @@ -551,39 +551,6 @@ TILEDB_EXPORT int32_t tiledb_subarray_add_point_ranges( const void* start, uint64_t count) TILEDB_NOEXCEPT; -#ifndef TILEDB_REMOVE_DEPRECATIONS -/** - * Adds a set of point ranges along subarray dimension index. Each value - * in the target array is added as `add_range(x,x)` for count elements. - * The datatype of the range components must be the same as the type of - * the dimension of the array in the query. - * - * **Example:** - * - * @code{.c} - * uint32_t dim_idx = 2; - * int64_t ranges[] = { 20, 21, 25, 31} - * tiledb_query_add_point_ranges(ctx, query, dim_idx, &ranges, 4); - * @endcode - * - * @param ctx The TileDB context. - * @param query The query to add the range to. - * @param dim_idx The index of the dimension to add the range to. - * @param start The start of the ranges array. - * @param count Number of ranges to add. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - * - * @note The stride is currently unsupported. Use `nullptr` as the - * stride argument. - */ -TILEDB_DEPRECATED_EXPORT int32_t tiledb_query_add_point_ranges( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - uint32_t dim_idx, - const void* start, - uint64_t count) TILEDB_NOEXCEPT; -#endif // TILEDB_REMOVE_DEPRECATIONS - /** * Get the number of relevant fragments from the subarray. Should only be * called after size estimation was asked for. @@ -781,7 +748,7 @@ TILEDB_EXPORT capi_return_t tiledb_ctx_alloc_with_error( * @param[in] array_uri The name of the TileDB array whose metadata will * be consolidated. * @param[in] fragment_uris Fragment names of the fragments to consolidate. The - * names can be recovered using tiledb_fragment_info_get_fragment_name. + * names can be recovered using tiledb_fragment_info_get_fragment_name_v2. * @param[in] num_fragments Number of URIs to consolidate. * @param config Configuration parameters for the consolidation * (`nullptr` means default, which will use the config from \p ctx). diff --git a/tiledb/sm/cpp_api/array.h b/tiledb/sm/cpp_api/array.h index 32ba99fb533..975a76d55a5 100644 --- a/tiledb/sm/cpp_api/array.h +++ b/tiledb/sm/cpp_api/array.h @@ -411,6 +411,22 @@ class Array { schema_ = ArraySchema(ctx, array_schema); } + // clang-format off + /** + * @copybrief Array::open(tiledb_query_type_t) + * + * See @ref Array::open(tiledb_query_type_t) "Array::open" + */ + // clang-format on + void open(tiledb_query_type_t query_type, uint64_t timestamp) { + auto& ctx = ctx_.get(); + tiledb_ctx_t* c_ctx = ctx.ptr().get(); + + ctx.handle_error( + tiledb_array_set_open_timestamp_end(c_ctx, array_.get(), timestamp)); + open(query_type); + } + // clang-format off /** * @copybrief Array::open(tiledb_query_type_t) @@ -602,7 +618,7 @@ class Array { * @param ctx TileDB context * @param array_uri The URI of the TileDB array to be consolidated. * @param fragment_uris Fragment names of the fragments to consolidate. The - * names can be recovered using tiledb_fragment_info_get_fragment_name. + * names can be recovered using tiledb_fragment_info_get_fragment_name_v2. * @param num_fragments The number of fragments to consolidate. * @param config Configuration parameters for the consolidation. */ @@ -1121,13 +1137,6 @@ class Array { std::memcpy((void*)key->data(), key_c, key_len); } -/* ********************************* */ -/* DEPRECATED API */ -/* ********************************* */ -#ifndef TILEDB_REMOVE_DEPRECATIONS -#include "array_deprecated.h" -#endif // TILEDB_REMOVE_DEPRECATIONS - private: /* ********************************* */ /* PRIVATE ATTRIBUTES */ diff --git a/tiledb/sm/cpp_api/array_deprecated.h b/tiledb/sm/cpp_api/array_deprecated.h deleted file mode 100644 index 7f861796218..00000000000 --- a/tiledb/sm/cpp_api/array_deprecated.h +++ /dev/null @@ -1,504 +0,0 @@ -/** - * @file array_deprecated.h - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2017-2023 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @section DESCRIPTION - * - * C++ Deprecated API for TileDB Array. - */ - -#include "tiledb.h" - -// clang-format off -/** - * @copybrief Array::Array(const Context&,const std::string&,tiledb_query_type_t,TemporalPolicy,EncryptionAlgorithm) - * - * See @ref Array::Array(const Context&,const std::string&,tiledb_query_type_t,TemporalPolicy,EncryptionAlgorithm) "Array::Array" - * - * @deprecated Release 2.15 - * @note Slated for removal in release 2.17 - * - * @param ctx TileDB context. - * @param array_uri The array URI. - * @param query_type Query type to open the array for. - * @param encryption_type The encryption type to use. - * @param encryption_key The encryption key to use. - */ -// clang-format on -TILEDB_DEPRECATED -Array( - const Context& ctx, - const std::string& array_uri, - tiledb_query_type_t query_type, - tiledb_encryption_type_t encryption_type, - const std::string& encryption_key) - : Array( - ctx, - array_uri, - query_type, - TemporalPolicy(), - EncryptionAlgorithm(encryption_type, encryption_key.c_str())) { -} - -// clang-format off -/** - * @copybrief Array::Array(const Context&,const std::string&,tiledb_query_type_t,TemporalPolicy,EncryptionAlgorithm) - * - * See @ref Array::Array(const Context&,const std::string&,tiledb_query_type_t,TemporalPolicy,EncryptionAlgorithm) "Array::Array" - * - * @deprecated Release 2.15 - * @note Slated for removal in release 2.17 - * - * @param ctx TileDB context. - * @param array_uri The array URI. - * @param query_type Query type to open the array for. - * @param timestamp The timestamp to open the array at. - */ -// clang-format on -TILEDB_DEPRECATED -Array( - const Context& ctx, - const std::string& array_uri, - tiledb_query_type_t query_type, - uint64_t timestamp) - : Array(ctx, array_uri, query_type, TemporalPolicy(TimeTravel, timestamp)) { -} - -// clang-format off -/** - * @copybrief Array::Array(const Context&,const std::string&,tiledb_query_type_t,TemporalPolicy,EncryptionAlgorithm) - * - * See @ref Array::Array(const Context&,const std::string&,tiledb_query_type_t,TemporalPolicy,EncryptionAlgorithm) "Array::Array" - * - * @deprecated Release 2.15 - * @note Slated for removal in release 2.17 - * - * @param ctx TileDB context. - * @param array_uri The array URI. - * @param query_type Query type to open the array for. - * @param encryption_type The encryption type to use. - * @param encryption_key The encryption key to use. - * @param key_length Length in bytes of the encryption key. - * @param timestamp The timestamp to open the array at. - */ -// clang-format on -TILEDB_DEPRECATED -Array( - const Context& ctx, - const std::string& array_uri, - tiledb_query_type_t query_type, - tiledb_encryption_type_t encryption_type, - const void* encryption_key, - uint32_t key_length, - uint64_t timestamp) - : Array( - ctx, - array_uri, - query_type, - TemporalPolicy(TimeTravel, timestamp), - EncryptionAlgorithm( - encryption_type, - std::string((const char*)encryption_key, key_length).c_str())) { -} - -// clang-format off -/** - * @copybrief Array::Array(const Context&,const std::string&,tiledb_query_type_t,TemporalPolicy,EncryptionAlgorithm) - * - * See @ref Array::Array(const Context&,const std::string&,tiledb_query_type_t,TemporalPolicy,EncryptionAlgorithm) "Array::Array" - * - * @deprecated Release 2.15 - * @note Slated for removal in release 2.17 - */ -// clang-format on -TILEDB_DEPRECATED -Array( - const Context& ctx, - const std::string& array_uri, - tiledb_query_type_t query_type, - tiledb_encryption_type_t encryption_type, - const std::string& encryption_key, - uint64_t timestamp) - : Array( - ctx, - array_uri, - query_type, - TemporalPolicy(TimeTravel, timestamp), - EncryptionAlgorithm(encryption_type, encryption_key.c_str())) { -} - -/** - * Note: This API is deprecated and replaced with a static method. - * - * @deprecated Release 2.15 - * @note Slated for removal in release 2.17 - */ -TILEDB_DEPRECATED -void delete_array(const std::string& uri) const { - auto& ctx = ctx_.get(); - ctx.handle_error( - tiledb_array_delete_array(ctx.ptr().get(), array_.get(), uri.c_str())); -} - -// clang-format off -/** - * @copybrief Array::open(tiledb_query_type_t) - * - * See @ref Array::open(tiledb_query_type_t) "Array::open" - * - * @deprecated Release 2.15 - * @note Slated for removal in release 2.17 - * - * @param query_type The type of queries the array object will be receiving. - * @param timestamp The timestamp to open the array at. - * @throws TileDBError if the array is already open or other error occurred. - */ -// clang-format on -TILEDB_DEPRECATED -void open(tiledb_query_type_t query_type, uint64_t timestamp) { - auto& ctx = ctx_.get(); - tiledb_ctx_t* c_ctx = ctx.ptr().get(); - ctx.handle_error( - tiledb_array_set_open_timestamp_end(c_ctx, array_.get(), timestamp)); - open(query_type); -} - -// clang-format off -/** - * @copybrief Array::open(tiledb_query_type_t,tiledb_encryption_type_t,const std::string&) - * - * See @ref Array::open(tiledb_query_type_t,tiledb_encryption_type_t,const std::string&) "Array::open" - * - * @deprecated Release 2.15 - * @note Slated for removal in release 2.17 - * - * @param query_type The type of queries the array object will be receiving. - * @param encryption_type The encryption type to use. - * @param encryption_key The encryption key to use. - * @param key_length Length in bytes of the encryption key. - * @param timestamp The timestamp to open the array at. - */ -// clang-format on -TILEDB_DEPRECATED -void open( - tiledb_query_type_t query_type, - tiledb_encryption_type_t encryption_type, - const void* encryption_key, - uint32_t key_length, - uint64_t timestamp) { - auto& ctx = ctx_.get(); - tiledb_ctx_t* c_ctx = ctx.ptr().get(); - - ctx.handle_error( - tiledb_array_set_open_timestamp_end(c_ctx, array_.get(), timestamp)); - - std::string enc_key_str((const char*)encryption_key, key_length); - open(query_type, encryption_type, enc_key_str); -} - -/** - * Deletes the fragments written between the input timestamps of an array - * with the input uri. - * - * @param uri The URI of the fragments' parent Array. - * @param timestamp_start The epoch start timestamp in milliseconds. - * @param timestamp_end The epoch end timestamp in milliseconds. Use - * UINT64_MAX for the current timestamp. - */ -TILEDB_DEPRECATED -void delete_fragments( - const std::string& uri, - uint64_t timestamp_start, - uint64_t timestamp_end) const { - throw std::logic_error( - "This method is deprecated. Please use " - "Array::delete_fragments(ctx, uri, timestamp_start, timestamp_end)"); - auto& ctx = ctx_.get(); - ctx.handle_error(tiledb_array_delete_fragments_v2( - ctx.ptr().get(), uri.c_str(), timestamp_start, timestamp_end)); -} - -/** - * @brief Consolidates the fragments of an encrypted array into a single - * fragment. - * - * You must first finalize all queries to the array before consolidation can - * begin (as consolidation temporarily acquires an exclusive lock on the - * array). - * - * **Example:** - * @code{.cpp} - * // Load AES-256 key from disk, environment variable, etc. - * uint8_t key[32] = ...; - * tiledb::Array::consolidate( - * ctx, - * "s3://bucket-name/array-name", - * TILEDB_AES_256_GCM, - * key, - * sizeof(key)); - * @endcode - * - * @param ctx TileDB context - * @param array_uri The URI of the TileDB array to be consolidated. - * @param encryption_type The encryption type to use. - * @param encryption_key The encryption key to use. - * @param key_length Length in bytes of the encryption key. - * @param config Configuration parameters for the consolidation. - */ -TILEDB_DEPRECATED -static void consolidate( - const Context& ctx, - const std::string& uri, - tiledb_encryption_type_t encryption_type, - const void* encryption_key, - uint32_t key_length, - Config* const config = nullptr) { - ctx.handle_error(tiledb_array_consolidate_with_key( - ctx.ptr().get(), - uri.c_str(), - encryption_type, - encryption_key, - key_length, - config ? config->ptr().get() : nullptr)); -} - -// clang-format off - /** - * @copybrief Array::consolidate(const Context&,const std::string&,tiledb_encryption_type_t,const void*,uint32_t,const Config&) - * - * See @ref Array::consolidate( - * const Context&, - * const std::string&, - * tiledb_encryption_type_t, - * const void*, - * uint32_t,const Config&) "Array::consolidate" - * - * @param ctx TileDB context - * @param array_uri The URI of the TileDB array to be consolidated. - * @param encryption_type The encryption type to use. - * @param encryption_key The encryption key to use. - * @param config Configuration parameters for the consolidation. - */ -// clang-format on -TILEDB_DEPRECATED -static void consolidate( - const Context& ctx, - const std::string& uri, - tiledb_encryption_type_t encryption_type, - const std::string& encryption_key, - Config* const config = nullptr) { - return consolidate( - ctx, - uri, - encryption_type, - encryption_key.data(), - (uint32_t)encryption_key.size(), - config); -} - -/** - * Loads the array schema from an encrypted array. - * - * **Example:** - * @code{.cpp} - * auto schema = tiledb::Array::load_schema(ctx, - * "s3://bucket-name/array-name", key_type, key, key_len); - * @endcode - * - * @param ctx The TileDB context. - * @param uri The array URI. - * @param encryption_type The encryption type to use. - * @param encryption_key The encryption key to use. - * @param key_length Length in bytes of the encryption key. - * @return The loaded ArraySchema object. - */ -TILEDB_DEPRECATED -static ArraySchema load_schema( - const Context& ctx, - const std::string& uri, - tiledb_encryption_type_t encryption_type, - const void* encryption_key, - uint32_t key_length) { - tiledb_array_schema_t* schema; - ctx.handle_error(tiledb_array_schema_load_with_key( - ctx.ptr().get(), - uri.c_str(), - encryption_type, - encryption_key, - key_length, - &schema)); - return ArraySchema(ctx, schema); -} - -/** - * @brief Creates a new encrypted TileDB array given an input schema. - * - * **Example:** - * @code{.cpp} - * // Load AES-256 key from disk, environment variable, etc. - * uint8_t key[32] = ...; - * tiledb::Array::create("s3://bucket-name/array-name", schema, - * TILEDB_AES_256_GCM, key, sizeof(key)); - * @endcode - * - * @param uri URI where array will be created. - * @param schema The array schema. - * @param encryption_type The encryption type to use. - * @param encryption_key The encryption key to use. - * @param key_length Length in bytes of the encryption key. - */ -TILEDB_DEPRECATED -static void create( - const std::string& uri, - const ArraySchema& schema, - tiledb_encryption_type_t encryption_type, - const void* encryption_key, - uint32_t key_length) { - auto& ctx = schema.context(); - tiledb_ctx_t* c_ctx = ctx.ptr().get(); - ctx.handle_error(tiledb_array_schema_check(c_ctx, schema.ptr().get())); - ctx.handle_error(tiledb_array_create_with_key( - c_ctx, - uri.c_str(), - schema.ptr().get(), - encryption_type, - encryption_key, - key_length)); -} - -// clang-format off - /** - * @copybrief Array::create(const std::string&,const ArraySchema&,tiledb_encryption_type_t,const void*,uint32_t) - * - * See @ref Array::create(const std::string&,const ArraySchema&,tiledb_encryption_type_t,const void*,uint32_t) "Array::create" - * - * @param uri URI where array will be created. - * @param schema The array schema. - * @param encryption_type The encryption type to use. - * @param encryption_key The encryption key to use. - */ -// clang-format on -TILEDB_DEPRECATED -static void create( - const std::string& uri, - const ArraySchema& schema, - tiledb_encryption_type_t encryption_type, - const std::string& encryption_key) { - return create( - uri, - schema, - encryption_type, - encryption_key.data(), - (uint32_t)encryption_key.size()); -} - -/** - * @brief Consolidates the metadata of an encrypted array. - * - * You must first finalize all queries to the array before consolidation can - * begin (as consolidation temporarily acquires an exclusive lock on the - * array). - * - * **Example:** - * @code{.cpp} - * // Load AES-256 key from disk, environment variable, etc. - * uint8_t key[32] = ...; - * tiledb::Array::consolidate_metadata( - * ctx, - * "s3://bucket-name/array-name", - * TILEDB_AES_256_GCM, - * key, - * sizeof(key)); - * @endcode - * - * @param ctx TileDB context - * @param array_uri The URI of the TileDB array whose - * metadata will be consolidated. - * @param encryption_type The encryption type to use. - * @param encryption_key The encryption key to use. - * @param key_length Length in bytes of the encryption key. - * @param config Configuration parameters for the consolidation. - */ -TILEDB_DEPRECATED -static void consolidate_metadata( - const Context& ctx, - const std::string& uri, - tiledb_encryption_type_t encryption_type, - const void* encryption_key, - uint32_t key_length, - Config* const config = nullptr) { - Config local_cfg; - Config* config_aux = config; - if (!config_aux) { - config_aux = &local_cfg; - } - - (*config_aux)["sm.consolidation.mode"] = "array_meta"; - consolidate( - ctx, uri, encryption_type, encryption_key, key_length, config_aux); -} - -// clang-format off - /** - * @copybrief Array::consolidate_metadata(const Context&, const std::string&, tiledb_encryption_type_t, const void*,uint32_t, const Config&) - * - * See @ref Array::consolidate_metadata( - * const Context&, - * const std::string&, - * tiledb_encryption_type_t, - * const void*, - * uint32_t,const Config&) "Array::consolidate_metadata" - * - * @param ctx TileDB context - * @param array_uri The URI of the TileDB array whose - * metadata will be consolidated. - * @param encryption_type The encryption type to use. - * @param encryption_key The encryption key to use. - * @param config Configuration parameters for the consolidation. - */ -// clang-format on -TILEDB_DEPRECATED -static void consolidate_metadata( - const Context& ctx, - const std::string& uri, - tiledb_encryption_type_t encryption_type, - const std::string& encryption_key, - Config* const config = nullptr) { - Config local_cfg; - Config* config_aux = config; - if (!config_aux) { - config_aux = &local_cfg; - } - - (*config_aux)["sm.consolidation.mode"] = "array_meta"; - consolidate( - ctx, - uri, - encryption_type, - encryption_key.data(), - (uint32_t)encryption_key.size(), - config_aux); -} diff --git a/tiledb/sm/cpp_api/array_schema.h b/tiledb/sm/cpp_api/array_schema.h index 5db18665988..0413aab83cf 100644 --- a/tiledb/sm/cpp_api/array_schema.h +++ b/tiledb/sm/cpp_api/array_schema.h @@ -601,13 +601,6 @@ class ArraySchema : public Schema { return ""; } -/* ********************************* */ -/* DEPRECATED API */ -/* ********************************* */ -#ifndef TILEDB_REMOVE_DEPRECATIONS -#include "array_schema_deprecated.h" -#endif // TILEDB_REMOVE_DEPRECATIONS - private: /* ********************************* */ /* PRIVATE ATTRIBUTES */ diff --git a/tiledb/sm/cpp_api/array_schema_deprecated.h b/tiledb/sm/cpp_api/array_schema_deprecated.h deleted file mode 100644 index 6348cd9a1a3..00000000000 --- a/tiledb/sm/cpp_api/array_schema_deprecated.h +++ /dev/null @@ -1,93 +0,0 @@ -/** - * @file array_schema_deprecated.h - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2024 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @section DESCRIPTION - * - * C++ Deprecated API for TileDB ArraySchema. - */ - -#include "tiledb.h" - -/** - * Loads the schema of an existing encrypted array. - * - * **Example:** - * @code{.cpp} - * // Load AES-256 key from disk, environment variable, etc. - * uint8_t key[32] = ...; - * tiledb::Context ctx; - * tiledb::ArraySchema schema(ctx, "s3://bucket-name/array-name", - * TILEDB_AES_256_GCM, key, sizeof(key)); - * @endcode - * - * @param ctx TileDB context - * @param uri URI of array - * @param encryption_type The encryption type to use. - * @param encryption_key The encryption key to use. - * @param key_length Length in bytes of the encryption key. - */ -TILEDB_DEPRECATED -ArraySchema( - const Context& ctx, - const std::string& uri, - tiledb_encryption_type_t encryption_type, - const void* encryption_key, - uint32_t key_length) - : Schema(ctx) { - tiledb_ctx_t* c_ctx = ctx.ptr().get(); - tiledb_array_schema_t* schema; - ctx.handle_error(tiledb_array_schema_load_with_key( - c_ctx, - uri.c_str(), - encryption_type, - encryption_key, - key_length, - &schema)); - schema_ = std::shared_ptr(schema, deleter_); -} - -/** - * Loads the schema of an existing encrypted array. - * - * @param ctx TileDB context - * @param uri URI of array - * @param encryption_type The encryption type to use. - * @param encryption_key The encryption key to use. - */ -TILEDB_DEPRECATED -ArraySchema( - const Context& ctx, - const std::string& uri, - tiledb_encryption_type_t encryption_type, - const std::string& encryption_key) - : ArraySchema( - ctx, - uri, - encryption_type, - encryption_key.data(), - (uint32_t)encryption_key.size()) { -} diff --git a/tiledb/sm/cpp_api/core_interface.h b/tiledb/sm/cpp_api/core_interface.h index 8011510ce36..c12bb17181d 100644 --- a/tiledb/sm/cpp_api/core_interface.h +++ b/tiledb/sm/cpp_api/core_interface.h @@ -42,29 +42,6 @@ namespace tiledb { namespace impl { -#ifndef TILEDB_REMOVE_DEPRECATIONS -/** - * @cond - * Doxygen is disabled for this function, as it conflicts with the C - * API function of the same name. - * - * Submits a TileDB query in asynchronous mode. - * - * @param ctx The TileDB context. - * @param query The query to be submitted. - * @param callback A pointer to a std::function. - * The function is copied. - * @param callback_data Data to pass callback - * @return TILEDB_OK for success and TILEDB_ERR for error. - */ -TILEDB_DEPRECATED_EXPORT int tiledb_query_submit_async_func( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - void* callback_func, - void* callback_data = nullptr) noexcept; -/** @endcond */ -#endif // TILEDB_REMOVE_DEPRECATIONS - inline size_t type_size(tiledb_datatype_t type) { return tiledb_datatype_size(type); } diff --git a/tiledb/sm/cpp_api/query.h b/tiledb/sm/cpp_api/query.h index 4507c47ff0f..fa4e5237a67 100644 --- a/tiledb/sm/cpp_api/query.h +++ b/tiledb/sm/cpp_api/query.h @@ -1059,13 +1059,6 @@ class Query { return array_.get(); } -/* ********************************* */ -/* DEPRECATED API */ -/* ********************************* */ -#ifndef TILEDB_REMOVE_DEPRECATIONS -#include "query_deprecated.h" -#endif // TILEDB_REMOVE_DEPRECATIONS - private: friend class QueryExperimental; @@ -1159,75 +1152,6 @@ class Query { return cell_val_num == TILEDB_VAR_NUM; } -#ifndef TILEDB_REMOVE_DEPRECATIONS - /** - * Sets a buffer for a fixed-sized attribute. - * - * @param attr Attribute name - * @param buff Buffer array pointer with elements of the attribute type. - * @param nelements Number of array elements. - * @param element_size Size of array elements (in bytes). - **/ - TILEDB_DEPRECATED Query& set_buffer( - const std::string& attr, - void* buff, - uint64_t nelements, - size_t element_size) { - auto ctx = ctx_.get(); - size_t size = nelements * element_size; - buff_sizes_[attr] = std::tuple(0, size, 0); - element_sizes_[attr] = element_size; - ctx.handle_error(tiledb_query_set_data_buffer( - ctx.ptr().get(), - query_.get(), - attr.c_str(), - buff, - &std::get<1>(buff_sizes_[attr]))); - return *this; - } - - /** - * Sets a buffer for a variable-sized attribute. - * - * @tparam T Attribute value type - * @param attr Attribute name - * @param offsets Offsets array pointer where a new element begins in the data - * buffer. - * @param offsets_nelements Number of elements in offsets buffer. - * @param data Buffer array pointer with elements of the attribute type. - * For variable sized attributes, the buffer should be flattened. - * @param data_nelements Number of array elements in data buffer. - * @param data_element_size Size of data array elements (in bytes). - **/ - TILEDB_DEPRECATED Query& set_buffer( - const std::string& attr, - uint64_t* offsets, - uint64_t offset_nelements, - void* data, - uint64_t data_nelements, - size_t data_element_size) { - auto ctx = ctx_.get(); - auto data_size = data_nelements * data_element_size; - auto offset_size = offset_nelements * sizeof(uint64_t); - element_sizes_[attr] = data_element_size; - buff_sizes_[attr] = - std::tuple(offset_size, data_size, 0); - ctx.handle_error(tiledb_query_set_data_buffer( - ctx.ptr().get(), - query_.get(), - attr.c_str(), - data, - &std::get<1>(buff_sizes_[attr]))); - ctx.handle_error(tiledb_query_set_offsets_buffer( - ctx.ptr().get(), - query_.get(), - attr.c_str(), - offsets, - &std::get<0>(buff_sizes_[attr]))); - return *this; - } -#endif // TILEDB_REMOVE_DEPRECATIONS - /** * Sets the data for a fixed/var-sized attribute/dimension. * @@ -1262,98 +1186,6 @@ class Query { &std::get<1>(buff_sizes_[attr]))); return *this; } - -#ifndef TILEDB_REMOVE_DEPRECATIONS - /** - * Sets a buffer for a nullable, fixed-sized attribute. - * - * @param attr Attribute name - * @param data Buffer array pointer with elements of the attribute type. - * @param data_nelements Number of array elements. - * @param data_element_size Size of array elements (in bytes). - * @param validity_bytemap Buffer array pointer with validity bytemap values. - * @param validity_bytemap_nelements Number of validity bytemap elements. - **/ - TILEDB_DEPRECATED Query& set_buffer_nullable( - const std::string& attr, - void* data, - uint64_t data_nelements, - size_t data_element_size, - uint8_t* validity_bytemap, - uint64_t validity_bytemap_nelements) { - auto ctx = ctx_.get(); - size_t data_size = data_nelements * data_element_size; - size_t validity_size = validity_bytemap_nelements * sizeof(uint8_t); - buff_sizes_[attr] = - std::tuple(0, data_size, validity_size); - element_sizes_[attr] = data_element_size; - ctx.handle_error(tiledb_query_set_data_buffer( - ctx.ptr().get(), - query_.get(), - attr.c_str(), - data, - &std::get<1>(buff_sizes_[attr]))); - ctx.handle_error(tiledb_query_set_validity_buffer( - ctx.ptr().get(), - query_.get(), - attr.c_str(), - validity_bytemap, - &std::get<2>(buff_sizes_[attr]))); - return *this; - } - - /** - * Sets a buffer for a nullable, variable-sized attribute. - * - * @tparam T Attribute value type - * @param attr Attribute name - * @param offsets Offsets array pointer where a new element begins in the data - * buffer. - * @param offsets_nelements Number of elements in offsets buffer. - * @param data Buffer array pointer with elements of the attribute type. - * For variable sized attributes, the buffer should be flattened. - * @param data_nelements Number of array elements in data buffer. - * @param data_element_size Size of data array elements (in bytes). - * @param validity_bytemap Buffer array pointer with validity bytemap values. - * @param validity_bytemap_nelements Number of validity bytemap elements. - **/ - TILEDB_DEPRECATED Query& set_buffer_nullable( - const std::string& attr, - uint64_t* offsets, - uint64_t offset_nelements, - void* data, - uint64_t data_nelements, - size_t data_element_size, - uint8_t* validity_bytemap, - uint64_t validity_bytemap_nelements) { - auto ctx = ctx_.get(); - auto data_size = data_nelements * data_element_size; - auto offset_size = offset_nelements * sizeof(uint64_t); - size_t validity_size = validity_bytemap_nelements * sizeof(uint8_t); - element_sizes_[attr] = data_element_size; - buff_sizes_[attr] = std::tuple( - offset_size, data_size, validity_size); - ctx.handle_error(tiledb_query_set_data_buffer( - ctx.ptr().get(), - query_.get(), - attr.c_str(), - data, - &std::get<1>(buff_sizes_[attr]))); - ctx.handle_error(tiledb_query_set_offsets_buffer( - ctx.ptr().get(), - query_.get(), - attr.c_str(), - offsets, - &std::get<0>(buff_sizes_[attr]))); - ctx.handle_error(tiledb_query_set_validity_buffer( - ctx.ptr().get(), - query_.get(), - attr.c_str(), - validity_bytemap, - &std::get<2>(buff_sizes_[attr]))); - return *this; - } -#endif // TILEDB_REMOVE_DEPRECATIONS }; /* ********************************* */ diff --git a/tiledb/sm/cpp_api/query_deprecated.h b/tiledb/sm/cpp_api/query_deprecated.h deleted file mode 100644 index 87a16ce13dc..00000000000 --- a/tiledb/sm/cpp_api/query_deprecated.h +++ /dev/null @@ -1,1298 +0,0 @@ -/** - * @file query_deprecated.h - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2024 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @section DESCRIPTION - * - * C++ Deprecated API for TileDB Query. - */ - -#include "tiledb.h" - -/** - * Submit an async query, with callback. Call returns immediately. - * - * Deprecated, call `submit()` on another thread instead. - * - * @note Same notes apply as `Query::submit()`. - * - * **Example:** - * @code{.cpp} - * // Create query - * tiledb::Query query(...); - * // Submit with callback - * query.submit_async([]() { std::cout << "Callback: query completed.\n"; }); - * @endcode - * - * @param callback Callback function. - */ -template -TILEDB_DEPRECATED void submit_async(const Fn& callback) { - std::function wrapper = [&](void*) { callback(); }; - auto& ctx = ctx_.get(); - ctx.handle_error(tiledb::impl::tiledb_query_submit_async_func( - ctx.ptr().get(), query_.get(), &wrapper, nullptr)); -} - -/** - * Submit an async query, with no callback. Call returns immediately. - * - * Deprecated, call `submit()` on another thread instead. - * - * @note Same notes apply as `Query::submit()`. - * - * **Example:** - * @code{.cpp} - * // Create query - * tiledb::Query query(...); - * // Submit with no callback - * query.submit_async(); - * @endcode - */ -TILEDB_DEPRECATED void submit_async() { - submit_async([]() {}); -} - -/** - * Adds a 1D range along a subarray dimension index, in the form - * (start, end, stride). The datatype of the range - * must be the same as the dimension datatype. - * - * **Example:** - * - * @code{.cpp} - * // Set a 1D range on dimension 0, assuming the domain type is int64. - * int64_t start = 10; - * int64_t end = 20; - * // Stride is optional - * subarray.add_range(0, start, end); - * @endcode - * - * @tparam T The dimension datatype - * @param dim_idx The index of the dimension to add the range to. - * @param start The range start to add. - * @param end The range end to add. - * @param stride The range stride to add. - * @return Reference to this Query - */ -template -TILEDB_DEPRECATED Query& add_range( - uint32_t dim_idx, T start, T end, T stride = 0) { - impl::type_check(schema_.domain().dimension(dim_idx).type()); - auto& ctx = ctx_.get(); - ctx.handle_error(tiledb_query_add_range( - ctx.ptr().get(), - query_.get(), - dim_idx, - &start, - &end, - (stride == 0) ? nullptr : &stride)); - return *this; -} - -/** - * Adds a 1D range along a subarray dimension name, specified by its name, in - * the form (start, end, stride). The datatype of the range must be the same - * as the dimension datatype. - * - * **Example:** - * - * @code{.cpp} - * // Set a 1D range on dimension "rows", assuming the domain type is int64. - * int64_t start = 10; - * int64_t end = 20; - * const std::string dim_name = "rows"; - * // Stride is optional - * subarray.add_range(dim_name, start, end); - * @endcode - * - * @tparam T The dimension datatype - * @param dim_name The name of the dimension to add the range to. - * @param start The range start to add. - * @param end The range end to add. - * @param stride The range stride to add. - * @return Reference to this Query - */ -template -TILEDB_DEPRECATED Query& add_range( - const std::string& dim_name, T start, T end, T stride = 0) { - impl::type_check(schema_.domain().dimension(dim_name).type()); - auto& ctx = ctx_.get(); - ctx.handle_error(tiledb_query_add_range_by_name( - ctx.ptr().get(), - query_.get(), - dim_name.c_str(), - &start, - &end, - (stride == 0) ? nullptr : &stride)); - return *this; -} - -/** - * Adds a 1D string range along a subarray dimension index, in the form - * (start, end). Applicable only to variable-sized dimensions - * - * **Example:** - * - * @code{.cpp} - * // Set a 1D range on variable-sized string dimension "rows" - * std::string start = "ab""; - * std::string end = "d"; - * // Stride is optional - * subarray.add_range(0, start, end); - * @endcode - * - * @tparam T The dimension datatype - * @param dim_idx The index of the dimension to add the range to. - * @param start The range start to add. - * @param end The range end to add. - * @return Reference to this Query - */ -TILEDB_DEPRECATED -Query& add_range( - uint32_t dim_idx, const std::string& start, const std::string& end) { - impl::type_check(schema_.domain().dimension(dim_idx).type()); - auto& ctx = ctx_.get(); - ctx.handle_error(tiledb_query_add_range_var( - ctx.ptr().get(), - query_.get(), - dim_idx, - start.c_str(), - start.size(), - end.c_str(), - end.size())); - return *this; -} - -/** - * Adds a 1D string range along a subarray dimension name, in the form (start, - * end). Applicable only to variable-sized dimensions - * - * **Example:** - * - * @code{.cpp} - * // Set a 1D range on variable-sized string dimension "rows" - * std::string start = "ab""; - * std::string end = "d"; - * const std::string dim_name = "rows"; - * // Stride is optional - * subarray.add_range(dim_name, start, end); - * @endcode - * - * @tparam T The dimension datatype - * @param dim_name The name of the dimension to add the range to. - * @param start The range start to add. - * @param end The range end to add. - * @return Reference to this Query - */ -TILEDB_DEPRECATED -Query& add_range( - const std::string& dim_name, - const std::string& start, - const std::string& end) { - impl::type_check(schema_.domain().dimension(dim_name).type()); - auto& ctx = ctx_.get(); - ctx.handle_error(tiledb_query_add_range_var_by_name( - ctx.ptr().get(), - query_.get(), - dim_name.c_str(), - start.c_str(), - start.size(), - end.c_str(), - end.size())); - return *this; -} - -/** - * Retrieves the number of ranges for a given dimension index. - * - * **Example:** - * - * @code{.cpp} - * unsigned dim_idx = 0; - * uint64_t range_num = query.range_num(dim_idx); - * @endcode - * - * @param dim_idx The dimension index. - * @return The number of ranges. - */ -TILEDB_DEPRECATED -uint64_t range_num(unsigned dim_idx) const { - auto& ctx = ctx_.get(); - uint64_t range_num; - ctx.handle_error(tiledb_query_get_range_num( - ctx.ptr().get(), query_.get(), dim_idx, &range_num)); - return range_num; -} - -/** - * Retrieves the number of ranges for a given dimension name. - * - * **Example:** - * - * @code{.cpp} - * unsigned dim_name = "rows"; - * uint64_t range_num = query.range_num(dim_name); - * @endcode - * - * @param dim_name The dimension name. - * @return The number of ranges. - */ -TILEDB_DEPRECATED -uint64_t range_num(const std::string& dim_name) const { - auto& ctx = ctx_.get(); - uint64_t range_num; - ctx.handle_error(tiledb_query_get_range_num_from_name( - ctx.ptr().get(), query_.get(), dim_name.c_str(), &range_num)); - return range_num; -} - -/** - * Retrieves a range for a given dimension index and range id. - * The template datatype must be the same as that of the - * underlying array. - * - * **Example:** - * - * @code{.cpp} - * unsigned dim_idx = 0; - * unsigned range_idx = 0; - * auto range = query.range(dim_idx, range_idx); - * @endcode - * - * @tparam T The dimension datatype. - * @param dim_idx The dimension index. - * @param range_idx The range index. - * @return A triplet of the form (start, end, stride). - */ -template -TILEDB_DEPRECATED std::array range(unsigned dim_idx, uint64_t range_idx) { - impl::type_check(schema_.domain().dimension(dim_idx).type()); - auto& ctx = ctx_.get(); - const void *start, *end, *stride; - ctx.handle_error(tiledb_query_get_range( - ctx.ptr().get(), - query_.get(), - dim_idx, - range_idx, - &start, - &end, - &stride)); - std::array ret = { - {*(const T*)start, - *(const T*)end, - (stride == nullptr) ? 0 : *(const T*)stride}}; - return ret; -} - -/** - * Retrieves a range for a given dimension name and range id. - * The template datatype must be the same as that of the - * underlying array. - * - * **Example:** - * - * @code{.cpp} - * unsigned dim_name = "rows"; - * unsigned range_idx = 0; - * auto range = query.range(dim_name, range_idx); - * @endcode - * - * @tparam T The dimension datatype. - * @param dim_name The dimension name. - * @param range_idx The range index. - * @return A triplet of the form (start, end, stride). - */ -template -TILEDB_DEPRECATED std::array range( - const std::string& dim_name, uint64_t range_idx) { - impl::type_check(schema_.domain().dimension(dim_name).type()); - auto& ctx = ctx_.get(); - const void *start, *end, *stride; - ctx.handle_error(tiledb_query_get_range_from_name( - ctx.ptr().get(), - query_.get(), - dim_name.c_str(), - range_idx, - &start, - &end, - &stride)); - std::array ret = { - {*(const T*)start, - *(const T*)end, - (stride == nullptr) ? 0 : *(const T*)stride}}; - return ret; -} - -/** - * Retrieves a range for a given variable length string dimension index and - * range id. - * - * **Example:** - * - * @code{.cpp} - * unsigned dim_idx = 0; - * unsigned range_idx = 0; - * std::array range = query.range(dim_idx, range_idx); - * @endcode - * - * @param dim_idx The dimension index. - * @param range_idx The range index. - * @return A pair of the form (start, end). - */ -TILEDB_DEPRECATED -std::array range(unsigned dim_idx, uint64_t range_idx) { - impl::type_check(schema_.domain().dimension(dim_idx).type()); - auto& ctx = ctx_.get(); - uint64_t start_size, end_size; - ctx.handle_error(tiledb_query_get_range_var_size( - ctx.ptr().get(), - query_.get(), - dim_idx, - range_idx, - &start_size, - &end_size)); - - std::string start; - start.resize(start_size); - std::string end; - end.resize(end_size); - ctx.handle_error(tiledb_query_get_range_var( - ctx.ptr().get(), query_.get(), dim_idx, range_idx, &start[0], &end[0])); - std::array ret = {{std::move(start), std::move(end)}}; - return ret; -} - -/** - * Retrieves a range for a given variable length string dimension name and - * range id. - * - * **Example:** - * - * @code{.cpp} - * unsigned dim_name = "rows"; - * unsigned range_idx = 0; - * std::array range = query.range(dim_name, range_idx); - * @endcode - * - * @param dim_name The dimension name. - * @param range_idx The range index. - * @return A pair of the form (start, end). - */ -TILEDB_DEPRECATED -std::array range( - const std::string& dim_name, uint64_t range_idx) { - impl::type_check(schema_.domain().dimension(dim_name).type()); - auto& ctx = ctx_.get(); - uint64_t start_size, end_size; - ctx.handle_error(tiledb_query_get_range_var_size_from_name( - ctx.ptr().get(), - query_.get(), - dim_name.c_str(), - range_idx, - &start_size, - &end_size)); - - std::string start; - start.resize(start_size); - std::string end; - end.resize(end_size); - ctx.handle_error(tiledb_query_get_range_var_from_name( - ctx.ptr().get(), - query_.get(), - dim_name.c_str(), - range_idx, - &start[0], - &end[0])); - std::array ret = {{std::move(start), std::move(end)}}; - return ret; -} - -/** - * The query set_subarray function has been deprecated. - * See the documentation for Subarray::set_subarray(), or use other - * Subarray provided APIs. - * Consult the current documentation for more information. - * - * Sets a subarray, defined in the order dimensions were added. - * Coordinates are inclusive. For the case of writes, this is meaningful only - * for dense arrays, and specifically dense writes. - * - * @note `set_subarray(std::vector)` is preferred as it is safer. - * - * **Example:** - * @code{.cpp} - * tiledb::Context ctx; - * tiledb::Array array(ctx, array_name, TILEDB_READ); - * int subarray[] = {0, 3, 0, 3}; - * Query query(ctx, array); - * query.set_subarray(subarray, 4); - * @endcode - * - * @tparam T Type of array domain. - * @param pairs Subarray pointer defined as an array of [start, stop] values - * per dimension. - * @param size The number of subarray elements. - */ -template -TILEDB_DEPRECATED Query& set_subarray(const T* pairs, uint64_t size) { - impl::type_check(schema_.domain().type()); - auto& ctx = ctx_.get(); - if (size != schema_.domain().ndim() * 2) { - throw SchemaMismatch( - "Subarray should have num_dims * 2 values: (low, high) for each " - "dimension."); - } - ctx.handle_error( - tiledb_query_set_subarray(ctx.ptr().get(), query_.get(), pairs)); - return *this; -} - -/** - * Sets a subarray, defined in the order dimensions were added. - * Coordinates are inclusive. For the case of writes, this is meaningful only - * for dense arrays, and specifically dense writes. - * - * **Example:** - * @code{.cpp} - * tiledb::Context ctx; - * tiledb::Array array(ctx, array_name, TILEDB_READ); - * std::vector subarray = {0, 3, 0, 3}; - * Query query(ctx, array); - * query.set_subarray(subarray); - * @endcode - * - * @tparam Vec Vector datatype. Should always be a vector of the domain type. - * @param pairs The subarray defined as a vector of [start, stop] coordinates - * per dimension. - */ -template -TILEDB_DEPRECATED Query& set_subarray(const Vec& pairs) { - return set_subarray(pairs.data(), pairs.size()); -} - -/** - * Sets a subarray, defined in the order dimensions were added. - * Coordinates are inclusive. For the case of writes, this is meaningful only - * for dense arrays, and specifically dense writes. - * - * **Example:** - * @code{.cpp} - * tiledb::Context ctx; - * tiledb::Array array(ctx, array_name, TILEDB_READ); - * Query query(ctx, array); - * query.set_subarray({0, 3, 0, 3}); - * @endcode - * - * @tparam T Type of array domain. - * @param pairs List of [start, stop] coordinates per dimension. - */ -template -TILEDB_DEPRECATED Query& set_subarray(const std::initializer_list& l) { - return set_subarray(std::vector(l)); -} - -/** - * Sets a subarray, defined in the order dimensions were added. - * Coordinates are inclusive. - * - * @note set_subarray(std::vector) is preferred and avoids an extra copy. - * - * @tparam T Type of array domain. - * @param pairs The subarray defined as pairs of [start, stop] per dimension. - */ -template -TILEDB_DEPRECATED Query& set_subarray( - const std::vector>& pairs) { - std::vector buf; - buf.reserve(pairs.size() * 2); - std::for_each(pairs.begin(), pairs.end(), [&buf](const std::array& p) { - buf.push_back(p[0]); - buf.push_back(p[1]); - }); - return set_subarray(buf); -} - -/** - * Set the coordinate buffer. - * - * The coordinate buffer has been deprecated. Set the coordinates for - * each individual dimension with the `set_buffer` API. Consult the current - * documentation for more information. - * - * **Example:** - * @code{.cpp} - * tiledb::Context ctx; - * tiledb::Array array(ctx, array_name, TILEDB_WRITE); - * // Write to points (0,1) and (2,3) in a 2D array with int domain. - * int coords[] = {0, 1, 2, 3}; - * Query query(ctx, array); - * query.set_layout(TILEDB_UNORDERED).set_coordinates(coords, 4); - * @endcode - * - * @note set_coordinates(std::vector) is preferred as it is safer. - * - * @tparam T Type of array domain. - * @param buf Coordinate array buffer pointer - * @param size The number of elements in the coordinate array buffer - * **/ -template -TILEDB_DEPRECATED Query& set_coordinates(T* buf, uint64_t size) { - impl::type_check(schema_.domain().type()); - return set_data_buffer("__coords", buf, size); -} - -/** - * Set the coordinate buffer for unordered queries. - * - * The coordinate buffer has been deprecated. Set the coordinates for - * each individual dimension with the `set_buffer` API. Consult the current - * documentation for more information. - * - * **Example:** - * @code{.cpp} - * tiledb::Context ctx; - * tiledb::Array array(ctx, array_name, TILEDB_WRITE); - * // Write to points (0,1) and (2,3) in a 2D array with int domain. - * std::vector coords = {0, 1, 2, 3}; - * Query query(ctx, array); - * query.set_layout(TILEDB_UNORDERED).set_coordinates(coords); - * @endcode - * - * @tparam Vec Vector datatype. Should always be a vector of the domain type. - * @param buf Coordinate vector - * **/ -template -TILEDB_DEPRECATED Query& set_coordinates(Vec& buf) { - return set_coordinates(buf.data(), buf.size()); -} - -/** - * Sets a buffer for a fixed-sized attribute/dimension. - * - * **Example:** - * @code{.cpp} - * tiledb::Context ctx; - * tiledb::Array array(ctx, array_name, TILEDB_WRITE); - * int data_a1[] = {0, 1, 2, 3}; - * Query query(ctx, array); - * query.set_buffer("a1", data_a1, 4); - * @endcode - * - * @note set_buffer(std::string, std::vector) is preferred as it is safer. - * - * @tparam T Attribute/Dimension value type - * @param name Attribute/Dimension name - * @param buff Buffer array pointer with elements of the - * attribute/dimension type. - * @param nelements Number of array elements - **/ -template -TILEDB_DEPRECATED Query& set_buffer( - const std::string& name, T* buff, uint64_t nelements) { - // Checks - auto is_attr = schema_.has_attribute(name); - auto is_dim = schema_.domain().has_dimension(name); - if (name != "__coords" && !is_attr && !is_dim) - throw TileDBError( - std::string("Cannot set buffer; Attribute/Dimension '") + name + - "' does not exist"); - else if (is_attr) - impl::type_check(schema_.attribute(name).type()); - else if (is_dim) - impl::type_check(schema_.domain().dimension(name).type()); - else if (name == "__coords") - impl::type_check(schema_.domain().type()); - - return set_data_buffer(name, buff, nelements, sizeof(T)); -} - -/** - * Sets a buffer for a fixed-sized attribute/dimension. - * - * **Example:** - * @code{.cpp} - * tiledb::Context ctx; - * tiledb::Array array(ctx, array_name, TILEDB_WRITE); - * std::vector data_a1 = {0, 1, 2, 3}; - * Query query(ctx, array); - * query.set_buffer("a1", data_a1); - * @endcode - * - * @tparam T Attribute/Dimension value type - * @param name Attribute/Dimension name - * @param buf Buffer vector with elements of the attribute/dimension type. - **/ -template -TILEDB_DEPRECATED Query& set_buffer( - const std::string& name, std::vector& buf) { - return set_data_buffer(name, buf.data(), buf.size(), sizeof(T)); -} - -/** - * Sets a buffer for a fixed-sized attribute/dimension. - * - * @note This unsafe version does not perform type checking; the given buffer - * is assumed to be the correct type, and the size of an element in the given - * buffer is assumed to be the size of the datatype of the attribute. - * - * @param name Attribute/Dimension name - * @param buff Buffer array pointer with elements of the attribute type. - * @param nelements Number of array elements in buffer - **/ -TILEDB_DEPRECATED Query& set_buffer( - const std::string& name, void* buff, uint64_t nelements) { - // Checks - auto is_attr = schema_.has_attribute(name); - auto is_dim = schema_.domain().has_dimension(name); - if (name != "__coords" && !is_attr && !is_dim) - throw TileDBError( - std::string("Cannot set buffer; Attribute/Dimension '") + name + - "' does not exist"); - - // Compute element size (in bytes). - size_t element_size = 0; - if (name == "__coords") - element_size = tiledb_datatype_size(schema_.domain().type()); - else if (is_attr) - element_size = tiledb_datatype_size(schema_.attribute(name).type()); - else if (is_dim) - element_size = - tiledb_datatype_size(schema_.domain().dimension(name).type()); - - return set_data_buffer(name, buff, nelements, element_size); -} - -/** - * Sets a buffer for a variable-sized attribute/dimension. - * - * **Example:** - * - * @code{.cpp} - * tiledb::Context ctx; - * tiledb::Array array(ctx, array_name, TILEDB_WRITE); - * int data_a1[] = {0, 1, 2, 3}; - * uint64_t offsets_a1[] = {0, 8}; - * Query query(ctx, array); - * query.set_buffer("a1", offsets_a1, 2, data_a1, 4); - * @endcode - * - * @note set_buffer(std::string, std::vector, std::vector) is preferred as it - * is safer. - * - * @tparam T Attribute/Dimension value type - * @param name Attribute/Dimension name - * @param offsets Offsets array pointer where a new element begins in the data - * buffer. - * @param offsets_nelements Number of elements in offsets buffer. - * @param data Buffer array pointer with elements of the attribute type. - * For variable sized attributes, the buffer should be flattened. - * @param data_nelements Number of array elements in data buffer. - **/ -template -TILEDB_DEPRECATED Query& set_buffer( - const std::string& name, - uint64_t* offsets, - uint64_t offset_nelements, - T* data, - uint64_t data_nelements) { - // Checks - auto is_attr = schema_.has_attribute(name); - auto is_dim = schema_.domain().has_dimension(name); - if (!is_attr && !is_dim) - throw TileDBError( - std::string("Cannot set buffer; Attribute/Dimension '") + name + - "' does not exist"); - else if (is_attr) - impl::type_check(schema_.attribute(name).type()); - else if (is_dim) - impl::type_check(schema_.domain().dimension(name).type()); - - set_data_buffer(name, data, data_nelements, sizeof(T)); - set_offsets_buffer(name, offsets, offset_nelements); - return *this; -} - -/** - * Sets a buffer for a variable-sized attribute/dimension. - * - * @note This unsafe version does not perform type checking; the given buffer - * is assumed to be the correct type, and the size of an element in the given - * buffer is assumed to be the size of the datatype of the attribute. - * - * @param name Attribute/Dimension name - * @param offsets Offsets array pointer where a new element begins in the data - * buffer. - * @param offsets_nelements Number of elements in offsets buffer. - * @param data Buffer array pointer with elements of the attribute type. - * @param data_nelements Number of array elements in data buffer. - **/ -TILEDB_DEPRECATED Query& set_buffer( - const std::string& name, - uint64_t* offsets, - uint64_t offset_nelements, - void* data, - uint64_t data_nelements) { - // Checks - auto is_attr = schema_.has_attribute(name); - auto is_dim = schema_.domain().has_dimension(name); - if (!is_attr && !is_dim) - throw TileDBError( - std::string("Cannot set buffer; Attribute/Dimension '") + name + - "' does not exist"); - - // Compute element size (in bytes). - auto type = is_attr ? schema_.attribute(name).type() : - schema_.domain().dimension(name).type(); - size_t element_size = tiledb_datatype_size(type); - - set_data_buffer(name, data, data_nelements, element_size); - set_offsets_buffer(name, offsets, offset_nelements); - return *this; -} - -/** - * Sets a buffer for a variable-sized attribute/dimension. - * - * **Example:** - * @code{.cpp} - * tiledb::Context ctx; - * tiledb::Array array(ctx, array_name, TILEDB_WRITE); - * std::vector data_a1 = {0, 1, 2, 3}; - * std::vector offsets_a1 = {0, 8}; - * Query query(ctx, array); - * query.set_buffer("a1", offsets_a1, data_a1); - * @endcode - * - * @tparam T Attribute/Dimension value type - * @param name Attribute/Dimension name - * @param offsets Offsets where a new element begins in the data buffer. - * @param data Buffer vector with elements of the attribute type. - * For variable sized attributes, the buffer should be flattened. E.x. - * an attribute of type std::string should have a buffer Vec type of - * std::string, where the values of each cell are concatenated. - **/ -template -TILEDB_DEPRECATED Query& set_buffer( - const std::string& name, - std::vector& offsets, - std::vector& data) { - // Checks - auto is_attr = schema_.has_attribute(name); - auto is_dim = schema_.domain().has_dimension(name); - if (!is_attr && !is_dim) - throw TileDBError( - std::string("Cannot set buffer; Attribute/Dimension '") + name + - "' does not exist"); - else if (is_attr) - impl::type_check(schema_.attribute(name).type()); - else if (is_dim) - impl::type_check(schema_.domain().dimension(name).type()); - - set_data_buffer(name, data.data(), data.size(), sizeof(T)); - set_offsets_buffer(name, offsets.data(), offsets.size()); - return *this; -} - -/** - * Sets a buffer for a variable-sized attribute/dimension. - * - * @tparam T Attribute/Dimension value type - * @param attr Attribute/Dimension name - * @param buf Pair of offset, data buffers - **/ -template -TILEDB_DEPRECATED Query& set_buffer( - const std::string& name, - std::pair, std::vector>& buf) { - // Checks - auto is_attr = schema_.has_attribute(name); - auto is_dim = schema_.domain().has_dimension(name); - if (!is_attr && !is_dim) - throw TileDBError( - std::string("Cannot set buffer; Attribute/Dimension '") + name + - "' does not exist"); - else if (is_attr) - impl::type_check(schema_.attribute(name).type()); - else if (is_dim) - impl::type_check(schema_.domain().dimension(name).type()); - - set_data_buffer(name, buf.second); - set_offsets_buffer(name, buf.first); - return *this; -} - -/** - * Sets a buffer for a string-typed variable-sized attribute/dimension. - * - * @param name Attribute/Dimension name - * @param offsets Offsets where a new element begins in the data buffer. - * @param data Pre-allocated string buffer. - **/ -TILEDB_DEPRECATED Query& set_buffer( - const std::string& name, - std::vector& offsets, - std::string& data) { - // Checks - auto is_attr = schema_.has_attribute(name); - auto is_dim = schema_.domain().has_dimension(name); - if (!is_attr && !is_dim) - throw TileDBError( - std::string("Cannot set buffer; Attribute/Dimension '") + name + - "' does not exist"); - else if (is_attr) - impl::type_check(schema_.attribute(name).type()); - else if (is_dim) - impl::type_check(schema_.domain().dimension(name).type()); - - set_data_buffer(name, &data[0], data.size(), sizeof(char)); - set_offsets_buffer(name, offsets.data(), offsets.size()); - return *this; -} - -/** - * Sets a buffer for a fixed-sized, nullable attribute. - * - * **Example:** - * @code{.cpp} - * tiledb::Context ctx; - * tiledb::Array array(ctx, array_name, TILEDB_WRITE); - * int data_a1[] = {0, 1, 2, 3}; - * uint8_t validity_bytemap[] = {1, 1, 0, 1}; - * Query query(ctx, array); - * query.set_buffer("a1", data_a1, 4, validity_bytemap, 4); - * @endcode - * - * @note set_buffer_nullable(std::string, std::vector, std::vector) - * is preferred as it is safer. - * - * @tparam T Attribute value type - * @param name Attribute name - * @param data Buffer array pointer with elements of the - * attribute type. - * @param data_nelements Number of array elements in `data` - * @param validity_bytemap The validity bytemap buffer. - * @param validity_bytemap_nelements The number of values within - * `validity_bytemap_nelements` - **/ -template -TILEDB_DEPRECATED Query& set_buffer_nullable( - const std::string& name, - T* data, - uint64_t data_nelements, - uint8_t* validity_bytemap, - uint64_t validity_bytemap_nelements) { - // Checks - auto is_attr = schema_.has_attribute(name); - if (!is_attr) - throw TileDBError( - std::string("Cannot set buffer; Attribute '") + name + - "' does not exist"); - else - impl::type_check(schema_.attribute(name).type()); - - set_data_buffer(name, data, data_nelements); - set_validity_buffer(name, validity_bytemap, validity_bytemap_nelements); - return *this; -} - -/** - * Sets a buffer for a fixed-sized, nullable attribute. - * - * **Example:** - * @code{.cpp} - * tiledb::Context ctx; - * tiledb::Array array(ctx, array_name, TILEDB_WRITE); - * std::vector data_a1 = {0, 1, 2, 3}; - * std::vector validity_bytemap = {1, 1, 0, 1}; - * Query query(ctx, array); - * query.set_buffer("a1", data_a1, validity_bytemap); - * @endcode - * - * @tparam T Attribute value type - * @param name Attribute name - * @param buf Buffer vector with elements of the attribute/dimension type. - * @param validity_bytemap Buffer vector with elements of the attribute - * validity values. - **/ -template -TILEDB_DEPRECATED Query& set_buffer_nullable( - const std::string& name, - std::vector& buf, - std::vector& validity_bytemap) { - set_data_buffer(name, buf.data(), buf.size(), sizeof(T)); - set_validity_buffer(name, validity_bytemap.data(), validity_bytemap.size()); - return *this; -} - -/** - * Sets a buffer for a fixed-sized, nullable attribute. - * - * @note This unsafe version does not perform type checking; the given buffer - * is assumed to be the correct type, and the size of an element in the given - * buffer is assumed to be the size of the datatype of the attribute. - * - * @param name Attribute name - * @param data Buffer array pointer with elements of the attribute type. - * @param data_nelements Number of array elements in buffer - * @param validity_bytemap The validity bytemap buffer. - * @param validity_bytemap_nelements The number of values within - * `validity_bytemap_nelements` - **/ -TILEDB_DEPRECATED Query& set_buffer_nullable( - const std::string& name, - void* data, - uint64_t data_nelements, - uint8_t* validity_bytemap, - uint64_t validity_bytemap_nelements) { - // Checks - auto is_attr = schema_.has_attribute(name); - if (!is_attr) - throw TileDBError( - std::string("Cannot set buffer; Attribute '") + name + - "' does not exist"); - - // Compute element size (in bytes). - size_t element_size = tiledb_datatype_size(schema_.attribute(name).type()); - - set_data_buffer(name, data, data_nelements, element_size); - set_validity_buffer(name, validity_bytemap, validity_bytemap_nelements); - return *this; -} - -/** - * Sets a buffer for a variable-sized, nullable attribute. - * - * @note This unsafe version does not perform type checking; the given buffer - * is assumed to be the correct type, and the size of an element in the given - * buffer is assumed to be the size of the datatype of the attribute. - * - * @param name Attribute name - * @param offsets Offsets array pointer where a new element begins in the data - * buffer. - * @param offsets_nelements Number of elements in offsets buffer. - * @param data Buffer array pointer with elements of the attribute type. - * @param data_nelements Number of array elements in data buffer. - * @param validity_bytemap The validity bytemap buffer. - * @param validity_bytemap_nelements The number of values within - * `validity_bytemap_nelements` - **/ -TILEDB_DEPRECATED Query& set_buffer_nullable( - const std::string& name, - uint64_t* offsets, - uint64_t offset_nelements, - void* data, - uint64_t data_nelements, - uint8_t* validity_bytemap, - uint64_t validity_bytemap_nelements) { - // Checks - auto is_attr = schema_.has_attribute(name); - if (!is_attr) - throw TileDBError( - std::string("Cannot set buffer; Attribute '") + name + - "' does not exist"); - - // Compute element size (in bytes). - auto type = schema_.attribute(name).type(); - size_t element_size = tiledb_datatype_size(type); - - set_data_buffer(name, data, data_nelements, element_size); - set_offsets_buffer(name, offsets, offset_nelements); - set_validity_buffer(name, validity_bytemap, validity_bytemap_nelements); - return *this; -} - -/** - * Sets a buffer for a variable-sized, nullable attribute. - * - * **Example:** - * @code{.cpp} - * tiledb::Context ctx; - * tiledb::Array array(ctx, array_name, TILEDB_WRITE); - * std::vector data_a1 = {0, 1, 2, 3}; - * std::vector offsets_a1 = {0, 8}; - * std::vector validity_bytemap = {1, 1, 0, 1}; - * Query query(ctx, array); - * query.set_buffer("a1", offsets_a1, data_a1, validity_bytemap); - * @endcode - * - * @tparam T Attribute value type - * @param name Attribute name - * @param offsets Offsets where a new element begins in the data buffer. - * @param data Buffer vector with elements of the attribute type. - * For variable sized attributes, the buffer should be flattened. E.x. - * an attribute of type std::string should have a buffer Vec type of - * std::string, where the values of each cell are concatenated. - * @param validity_bytemap Buffer vector with elements of the attribute - * validity values. - **/ -template -TILEDB_DEPRECATED Query& set_buffer_nullable( - const std::string& name, - std::vector& offsets, - std::vector& data, - std::vector& validity_bytemap) { - // Checks - auto is_attr = schema_.has_attribute(name); - if (!is_attr) - throw TileDBError( - std::string("Cannot set buffer; Attribute '") + name + - "' does not exist"); - else - impl::type_check(schema_.attribute(name).type()); - - set_data_buffer(name, data.data(), data.size(), sizeof(T)); - set_offsets_buffer(name, offsets.data(), offsets.size()); - set_validity_buffer(name, validity_bytemap.data(), validity_bytemap.size()); - return *this; -} - -/** - * Sets a buffer for a variable-sized, nullable attribute. - * - * @tparam T Attribute value type - * @param attr Attribute name - * @param buf Pair of offset, data, validity bytemap buffers - **/ -template -TILEDB_DEPRECATED Query& set_buffer_nullable( - const std::string& name, - std::tuple, std::vector, std::vector>& - buf) { - // Checks - auto is_attr = schema_.has_attribute(name); - if (!is_attr) - throw TileDBError( - std::string("Cannot set buffer; Attribute '") + name + - "' does not exist"); - impl::type_check(schema_.attribute(name).type()); - - set_data_buffer(name, std::get<1>(buf)); - set_offsets_buffer(name, std::get<0>(buf)); - set_validity_buffer(name, std::get<2>(buf)); - return *this; -} - -/** - * Sets a buffer for a string-typed variable-sized, nullable attribute. - * - * @param name Attribute name - * @param offsets Offsets where a new element begins in the data buffer. - * @param data Pre-allocated string buffer. - * @param validity_bytemap Buffer vector with elements of the attribute - * validity values. - **/ -TILEDB_DEPRECATED Query& set_buffer_nullable( - const std::string& name, - std::vector& offsets, - std::string& data, - std::vector& validity_bytemap) { - // Checks - auto is_attr = schema_.has_attribute(name); - if (!is_attr) - throw TileDBError( - std::string("Cannot set buffer; Attribute '") + name + - "' does not exist"); - else - impl::type_check(schema_.attribute(name).type()); - - set_data_buffer(name, &data[0], data.size(), sizeof(char)); - set_offsets_buffer(name, offsets.data(), offsets.size()); - set_validity_buffer(name, validity_bytemap.data(), validity_bytemap.size()); - return *this; -} - -/** - * Gets a buffer for a fixed-sized attribute/dimension. - * - * @param name Attribute/dimension name - * @param data Buffer array pointer with elements of the attribute type. - * @param data_nelements Number of array elements. - * @param element_size Size of array elements (in bytes). - **/ -TILEDB_DEPRECATED Query& get_buffer( - const std::string& name, - void** data, - uint64_t* data_nelements, - uint64_t* element_size) { - auto ctx = ctx_.get(); - uint64_t* data_nbytes = nullptr; - auto elem_size_iter = element_sizes_.find(name); - if (elem_size_iter == element_sizes_.end()) { - throw TileDBError( - "[TileDB::C++API] Error: No buffer set for attribute '" + name + "'!"); - } - - ctx.handle_error(tiledb_query_get_data_buffer( - ctx.ptr().get(), query_.get(), name.c_str(), data, &data_nbytes)); - - assert(*data_nbytes % elem_size_iter->second == 0); - - *data_nelements = (*data_nbytes) / elem_size_iter->second; - *element_size = elem_size_iter->second; - - return *this; -} - -/** - * Gets a buffer for a var-sized attribute/dimension. - * - * @param name Attribute/dimension name - * @param offsets Offsets array pointer with elements of uint64_t type. - * @param offsets_nelements Number of array elements. - * @param data Buffer array pointer with elements of the attribute type. - * @param data_nelements Number of array elements. - * @param element_size Size of array elements (in bytes). - **/ -TILEDB_DEPRECATED Query& get_buffer( - const std::string& name, - uint64_t** offsets, - uint64_t* offsets_nelements, - void** data, - uint64_t* data_nelements, - uint64_t* element_size) { - auto ctx = ctx_.get(); - uint64_t* offsets_nbytes = nullptr; - uint64_t* data_nbytes = nullptr; - auto elem_size_iter = element_sizes_.find(name); - if (elem_size_iter == element_sizes_.end()) { - throw TileDBError( - "[TileDB::C++API] Error: No buffer set for attribute '" + name + "'!"); - } - - ctx.handle_error(tiledb_query_get_data_buffer( - ctx.ptr().get(), query_.get(), name.c_str(), data, &data_nbytes)); - ctx.handle_error(tiledb_query_get_offsets_buffer( - ctx.ptr().get(), query_.get(), name.c_str(), offsets, &offsets_nbytes)); - - assert(*data_nbytes % elem_size_iter->second == 0); - assert(*offsets_nbytes % sizeof(uint64_t) == 0); - - *data_nelements = (*data_nbytes) / elem_size_iter->second; - *offsets_nelements = (*offsets_nbytes) / sizeof(uint64_t); - *element_size = elem_size_iter->second; - - return *this; -} - -/** - * Gets a buffer for a fixed-sized, nullable attribute. - * - * @param name Attribute name - * @param data Buffer array pointer with elements of the attribute type. - * @param data_nelements Number of array elements. - * @param data_element_size Size of array elements (in bytes). - * @param validity_bytemap Buffer array pointer with elements of the - * attribute validity values. - * @param validity_bytemap_nelements Number of validity bytemap elements. - **/ -TILEDB_DEPRECATED Query& get_buffer_nullable( - const std::string& name, - void** data, - uint64_t* data_nelements, - uint64_t* data_element_size, - uint8_t** validity_bytemap, - uint64_t* validity_bytemap_nelements) { - auto ctx = ctx_.get(); - uint64_t* data_nbytes = nullptr; - uint64_t* validity_bytemap_nbytes = nullptr; - auto elem_size_iter = element_sizes_.find(name); - if (elem_size_iter == element_sizes_.end()) { - throw TileDBError( - "[TileDB::C++API] Error: No buffer set for attribute '" + name + "'!"); - } - - ctx.handle_error(tiledb_query_get_data_buffer( - ctx.ptr().get(), query_.get(), name.c_str(), data, &data_nbytes)); - ctx.handle_error(tiledb_query_get_validity_buffer( - ctx.ptr().get(), - query_.get(), - name.c_str(), - validity_bytemap, - &validity_bytemap_nbytes)); - - assert(*data_nbytes % elem_size_iter->second == 0); - - *data_nelements = *data_nbytes / elem_size_iter->second; - *data_element_size = elem_size_iter->second; - *validity_bytemap_nelements = *validity_bytemap_nbytes / sizeof(uint8_t); - - return *this; -} - -/** - * Gets a buffer for a var-sized, nullable attribute. - * - * @param name Attribute name - * @param offsets Offsets array pointer with elements of uint64_t type. - * @param offsets_nelements Number of array elements. - * @param data Buffer array pointer with elements of the attribute type. - * @param data_nelements Number of array elements. - * @param element_size Size of array elements (in bytes). - * @param validity_bytemap Buffer array pointer with elements of the - * attribute validity values. - * @param validity_bytemap_nelements Number of validity bytemap elements. - **/ -TILEDB_DEPRECATED Query& get_buffer_nullable( - const std::string& name, - uint64_t** offsets, - uint64_t* offsets_nelements, - void** data, - uint64_t* data_nelements, - uint64_t* element_size, - uint8_t** validity_bytemap, - uint64_t* validity_bytemap_nelements) { - auto ctx = ctx_.get(); - uint64_t* offsets_nbytes = nullptr; - uint64_t* data_nbytes = nullptr; - uint64_t* validity_bytemap_nbytes = nullptr; - auto elem_size_iter = element_sizes_.find(name); - if (elem_size_iter == element_sizes_.end()) { - throw TileDBError( - "[TileDB::C++API] Error: No buffer set for attribute '" + name + "'!"); - } - - ctx.handle_error(tiledb_query_get_data_buffer( - ctx.ptr().get(), query_.get(), name.c_str(), data, &data_nbytes)); - ctx.handle_error(tiledb_query_get_offsets_buffer( - ctx.ptr().get(), query_.get(), name.c_str(), offsets, &offsets_nbytes)); - ctx.handle_error(tiledb_query_get_validity_buffer( - ctx.ptr().get(), - query_.get(), - name.c_str(), - validity_bytemap, - &validity_bytemap_nbytes)); - - assert(*data_nbytes % elem_size_iter->second == 0); - assert(*offsets_nbytes % sizeof(uint64_t) == 0); - - *data_nelements = (*data_nbytes) / elem_size_iter->second; - *offsets_nelements = (*offsets_nbytes) / sizeof(uint64_t); - *element_size = elem_size_iter->second; - *validity_bytemap_nelements = *validity_bytemap_nbytes / sizeof(uint8_t); - - return *this; -}