diff --git a/include/tiledb/api/c_api/group/group_api_external_experimental.h b/include/tiledb/api/c_api/group/group_api_external_experimental.h index 8ddcbf8..469931a 100644 --- a/include/tiledb/api/c_api/group/group_api_external_experimental.h +++ b/include/tiledb/api/c_api/group/group_api_external_experimental.h @@ -403,6 +403,7 @@ 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. @@ -441,6 +442,7 @@ TILEDB_DEPRECATED_EXPORT capi_return_t tiledb_group_get_member_by_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 @@ -481,6 +483,7 @@ 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. @@ -518,6 +521,7 @@ TILEDB_DEPRECATED_EXPORT capi_return_t tiledb_group_get_member_by_name( 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. diff --git a/include/tiledb/array.h b/include/tiledb/array.h index b11d0b9..32ba99f 100644 --- a/include/tiledb/array.h +++ b/include/tiledb/array.h @@ -345,28 +345,6 @@ class Array { ctx.handle_error(tiledb_array_delete(ctx.ptr().get(), uri.c_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)); - } - /** * Deletes the fragments written between the input timestamps of an array * with the input uri. @@ -600,7 +578,7 @@ class Array { } /** - * @brief Consolidates the fragments of an encrypted array into a single + * @brief Consolidates the fragments with the input uris into a single * fragment. * * You must first finalize all queries to the array before consolidation can @@ -609,73 +587,39 @@ class Array { * * **Example:** * @code{.cpp} - * // Load AES-256 key from disk, environment variable, etc. - * uint8_t key[32] = ...; + * const char* fragment_uris[2] = { + * "__1712657401931_1712657401931_285cf8a0eff4df875a04cfbea96d5c00_21", + * "__1712657401948_1712657401948_285cf8a0efdsafas6a5a04cfbesajads_21"}; + * * tiledb::Array::consolidate( * ctx, * "s3://bucket-name/array-name", - * TILEDB_AES_256_GCM, - * key, - * sizeof(key)); + * fragment_uris, + * 2, + * config); * @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 fragment_uris Fragment names of the fragments to consolidate. The + * names can be recovered using tiledb_fragment_info_get_fragment_name. + * @param num_fragments The number of fragments to consolidate. * @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, + const std::string& array_uri, + const char* fragment_uris[], + const size_t num_fragments, Config* const config = nullptr) { - ctx.handle_error(tiledb_array_consolidate_with_key( + ctx.handle_error(tiledb_array_consolidate_fragments( ctx.ptr().get(), - uri.c_str(), - encryption_type, - encryption_key, - key_length, + array_uri.c_str(), + fragment_uris, + num_fragments, 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 - 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); - } - /** * Cleans up the array, such as consolidated fragments and array metadata. * Note that this will coarsen the granularity of time traveling (see docs @@ -737,101 +681,6 @@ class Array { return ArraySchema(ctx, schema); } - /** - * 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 - 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()); - } - /** * Gets the encryption type the given array was created with. * @@ -1111,93 +960,6 @@ class Array { consolidate(ctx, uri, config_aux); } - /** - * @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 - 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); - } - /** * @brief Upgrades an array to the latest format version. * diff --git a/include/tiledb/array_deprecated.h b/include/tiledb/array_deprecated.h index 7c8ef78..7f86179 100644 --- a/include/tiledb/array_deprecated.h +++ b/include/tiledb/array_deprecated.h @@ -218,3 +218,287 @@ void open( 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/include/tiledb/array_schema.h b/include/tiledb/array_schema.h index 1e1681e..16d472d 100644 --- a/include/tiledb/array_schema.h +++ b/include/tiledb/array_schema.h @@ -133,65 +133,6 @@ class ArraySchema : public Schema { schema_ = std::shared_ptr(schema, deleter_); } - /** - * 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. - */ - 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()) { - } - /** * Loads the schema of an existing array with the input C array * schema object. @@ -671,6 +612,13 @@ 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/include/tiledb/array_schema_deprecated.h b/include/tiledb/array_schema_deprecated.h new file mode 100644 index 0000000..6348cd9 --- /dev/null +++ b/include/tiledb/array_schema_deprecated.h @@ -0,0 +1,93 @@ +/** + * @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/include/tiledb/core_interface.h b/include/tiledb/core_interface.h index c74a1f5..8011510 100644 --- a/include/tiledb/core_interface.h +++ b/include/tiledb/core_interface.h @@ -42,6 +42,7 @@ namespace tiledb { namespace impl { +#ifndef TILEDB_REMOVE_DEPRECATIONS /** * @cond * Doxygen is disabled for this function, as it conflicts with the C @@ -56,12 +57,13 @@ namespace impl { * @param callback_data Data to pass callback * @return TILEDB_OK for success and TILEDB_ERR for error. */ -TILEDB_EXPORT int tiledb_query_submit_async_func( +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/include/tiledb/query.h b/include/tiledb/query.h index a7603be..4507c47 100644 --- a/include/tiledb/query.h +++ b/include/tiledb/query.h @@ -300,46 +300,6 @@ class Query { return query_status(); } - /** - * Submit an async query, with callback. Call returns immediately. - * - * @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 - 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. - * - * @note Same notes apply as `Query::submit()`. - * - * **Example:** - * @code{.cpp} - * // Create query - * tiledb::Query query(...); - * // Submit with no callback - * query.submit_async(); - * @endcode - */ - void submit_async() { - submit_async([]() {}); - } - /** * Flushes all internal state of a query object and finalizes the query. * This is applicable only to global layout writes. It has no effect for @@ -501,362 +461,6 @@ class Query { return elements; } - /** - * 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; - } - /** * Retrieves the estimated result size for a fixed-size attribute. * This is an estimate and may not be sufficient to read all results for the @@ -1014,112 +618,6 @@ class Query { return std::make_pair(t1, t2); } - /** - * 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); - } - /** * Prepare a query with the contents of a subarray. * @@ -1174,61 +672,14 @@ class Query { } /** - * 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 + * Sets the data for a fixed/var-sized attribute/dimension. * - * @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. + * The caller owns the buffer provided and is responsible for freeing the + * memory associated with it. For writes, the buffer holds values to be + * written which can be freed at any time after query completion. For reads, + * the buffer is allocated by the caller and will contain data read by the + * query after completion. The freeing of this memory is up to the caller once + * they are done referencing the read data. * * **Example:** * @code{.cpp} @@ -1236,10 +687,11 @@ class Query { * 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); + * query.set_data_buffer("a1", data_a1, 4); * @endcode * - * @note set_buffer(std::string, std::vector) is preferred as it is safer. + * @note set_data_buffer(std::string, std::vector) is preferred as it is + * safer. * * @tparam T Attribute/Dimension value type * @param name Attribute/Dimension name @@ -1248,27 +700,15 @@ class Query { * @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()); + Query& set_data_buffer(const std::string& name, T* buff, uint64_t nelements) { + // Check we have the correct type. + impl::type_check(field_type(name)); return set_data_buffer(name, buff, nelements, sizeof(T)); } /** - * Sets a buffer for a fixed-sized attribute/dimension. + * Sets the data for a fixed/var-sized attribute/dimension. * * **Example:** * @code{.cpp} @@ -1276,7 +716,7 @@ class Query { * 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); + * query.set_data_buffer("a1", data_a1); * @endcode * * @tparam T Attribute/Dimension value type @@ -1284,298 +724,19 @@ class Query { * @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)); + Query& set_data_buffer(const std::string& name, std::vector& buf) { + return set_data_buffer(name, buf.data(), buf.size()); } /** - * 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 the data for a fixed/var-sized attribute/dimension. - * - * The caller owns the buffer provided and is responsible for freeing the - * memory associated with it. For writes, the buffer holds values to be - * written which can be freed at any time after query completion. For reads, - * the buffer is allocated by the caller and will contain data read by the - * query after completion. The freeing of this memory is up to the caller once - * they are done referencing the read data. - * - * **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_data_buffer("a1", data_a1, 4); - * @endcode - * - * @note set_data_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 - Query& set_data_buffer(const std::string& name, T* buff, uint64_t nelements) { - // Check we have the correct type. - impl::type_check(field_type(name)); - - return set_data_buffer(name, buff, nelements, sizeof(T)); - } - - /** - * Sets the data for a fixed/var-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_data_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 - Query& set_data_buffer(const std::string& name, std::vector& buf) { - return set_data_buffer(name, buf.data(), buf.size()); - } - - /** - * Sets the data for a fixed/var-sized attribute/dimension. - * - * The caller owns the buffer provided and is responsible for freeing the - * memory associated with it. For writes, the buffer holds values to be - * written which can be freed at any time after query completion. For reads, - * the buffer is allocated by the caller and will contain data read by the - * query after completion. The freeing of this memory is up to the caller once - * they are done referencing the read data. + * Sets the data for a fixed/var-sized attribute/dimension. + * + * The caller owns the buffer provided and is responsible for freeing the + * memory associated with it. For writes, the buffer holds values to be + * written which can be freed at any time after query completion. For reads, + * the buffer is allocated by the caller and will contain data read by the + * query after completion. The freeing of this memory is up to the caller once + * they are done referencing the read data. * * @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 @@ -1636,435 +797,108 @@ class Query { **/ Query& set_offsets_buffer( const std::string& attr, uint64_t* offsets, uint64_t offset_nelements) { - auto ctx = ctx_.get(); - auto offset_size = offset_nelements * sizeof(uint64_t); - auto buff_sizes_iter = buff_sizes_.find(attr); - if (buff_sizes_iter == buff_sizes_.end()) { - buff_sizes_[attr] = - std::tuple(offset_size, 0, 0); - } else { - auto& second = buff_sizes_iter->second; - buff_sizes_[attr] = std::tuple( - offset_size, std::get<1>(second), std::get<2>(second)); - } - - 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; - } - - /** - * Sets the offset buffer for a var-sized attribute/dimension. - * - * **Example:** - * @code{.cpp} - * tiledb::Context ctx; - * tiledb::Array array(ctx, array_name, TILEDB_WRITE); - * std::vector offsets_a1 = {0, 8}; - * Query query(ctx, array); - * query.set_offsets_buffer("a1", offsets_a1); - * @endcode - * - * @param name Attribute/Dimension name - * @param offsets Offsets where a new element begins in the data buffer. - **/ - Query& set_offsets_buffer( - const std::string& name, std::vector& offsets) { - return set_offsets_buffer(name, offsets.data(), offsets.size()); - } - - /** - * Sets the validity buffer for nullable attribute/dimension. - * - * The caller owns the buffer provided and is responsible for freeing the - * memory associated with it. For writes, the buffer holds validity values to - * be written which can be freed at any time after query completion. For - * reads, the buffer is allocated by the caller and will contain the validity - * map read by the query after completion. The freeing of this memory is up to - * the caller once they are done referencing the read data. - * - * @tparam T Attribute value type - * @param attr Attribute name - * @param validity_bytemap The validity bytemap buffer. - * @param validity_bytemap_nelements The number of values within - * `validity_bytemap_nelements` - **/ - Query& set_validity_buffer( - const std::string& attr, - uint8_t* validity_bytemap, - uint64_t validity_bytemap_nelements) { - auto ctx = ctx_.get(); - size_t validity_size = validity_bytemap_nelements * sizeof(uint8_t); - auto buff_sizes_iter = buff_sizes_.find(attr); - if (buff_sizes_iter == buff_sizes_.end()) { - buff_sizes_[attr] = - std::tuple(0, 0, validity_size); - } else { - auto& second = buff_sizes_iter->second; - buff_sizes_[attr] = std::tuple( - std::get<0>(second), std::get<1>(second), validity_size); - } - - 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 the validity buffer for nullable attribute/dimension. - * - * **Example:** - * @code{.cpp} - * tiledb::Context ctx; - * tiledb::Array array(ctx, array_name, TILEDB_WRITE); - * std::vector validity_bytemap = {1, 1, 0, 1}; - * Query query(ctx, array); - * query.set_validity_buffer("a1", validity_bytemap); - * @endcode - * - * @param name Attribute name - * @param validity_bytemap Buffer vector with elements of the attribute - * validity values. - **/ - Query& set_validity_buffer( - const std::string& name, std::vector& validity_bytemap) { - return set_validity_buffer( - name, validity_bytemap.data(), validity_bytemap.size()); - } - - /** - * 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); + auto ctx = ctx_.get(); + auto offset_size = offset_nelements * sizeof(uint64_t); + auto buff_sizes_iter = buff_sizes_.find(attr); + if (buff_sizes_iter == buff_sizes_.end()) { + buff_sizes_[attr] = + std::tuple(offset_size, 0, 0); + } else { + auto& second = buff_sizes_iter->second; + buff_sizes_[attr] = std::tuple( + offset_size, std::get<1>(second), std::get<2>(second)); + } - 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); + 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; } /** - * Sets a buffer for a variable-sized, nullable attribute. + * Sets the offset buffer for a var-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}; - * std::vector validity_bytemap = {1, 1, 0, 1}; * Query query(ctx, array); - * query.set_buffer("a1", offsets_a1, data_a1, validity_bytemap); + * query.set_offsets_buffer("a1", offsets_a1); * @endcode * - * @tparam T Attribute value type - * @param name Attribute name + * @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. - * @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; + Query& set_offsets_buffer( + const std::string& name, std::vector& offsets) { + return set_offsets_buffer(name, offsets.data(), offsets.size()); } /** - * Sets a buffer for a variable-sized, nullable attribute. + * Sets the validity buffer for nullable attribute/dimension. + * + * The caller owns the buffer provided and is responsible for freeing the + * memory associated with it. For writes, the buffer holds validity values to + * be written which can be freed at any time after query completion. For + * reads, the buffer is allocated by the caller and will contain the validity + * map read by the query after completion. The freeing of this memory is up to + * the caller once they are done referencing the read data. * * @tparam T Attribute value type * @param attr Attribute name - * @param buf Pair of offset, data, validity bytemap buffers + * @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, - 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()); + Query& set_validity_buffer( + const std::string& attr, + uint8_t* validity_bytemap, + uint64_t validity_bytemap_nelements) { + auto ctx = ctx_.get(); + size_t validity_size = validity_bytemap_nelements * sizeof(uint8_t); + auto buff_sizes_iter = buff_sizes_.find(attr); + if (buff_sizes_iter == buff_sizes_.end()) { + buff_sizes_[attr] = + std::tuple(0, 0, validity_size); + } else { + auto& second = buff_sizes_iter->second; + buff_sizes_[attr] = std::tuple( + std::get<0>(second), std::get<1>(second), validity_size); + } - set_data_buffer(name, std::get<1>(buf)); - set_offsets_buffer(name, std::get<0>(buf)); - set_validity_buffer(name, std::get<2>(buf)); + 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 string-typed variable-sized, nullable attribute. + * Sets the validity buffer for nullable attribute/dimension. + * + * **Example:** + * @code{.cpp} + * tiledb::Context ctx; + * tiledb::Array array(ctx, array_name, TILEDB_WRITE); + * std::vector validity_bytemap = {1, 1, 0, 1}; + * Query query(ctx, array); + * query.set_validity_buffer("a1", validity_bytemap); + * @endcode * * @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; + Query& set_validity_buffer( + const std::string& name, std::vector& validity_bytemap) { + return set_validity_buffer( + name, validity_bytemap.data(), validity_bytemap.size()); } /** @@ -2148,107 +982,6 @@ class Query { 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; - } - /** Returns a JSON-formatted string of the stats. */ std::string stats() { auto ctx = ctx_.get(); @@ -2326,6 +1059,13 @@ class Query { return array_.get(); } +/* ********************************* */ +/* DEPRECATED API */ +/* ********************************* */ +#ifndef TILEDB_REMOVE_DEPRECATIONS +#include "query_deprecated.h" +#endif // TILEDB_REMOVE_DEPRECATIONS + private: friend class QueryExperimental; @@ -2419,6 +1159,7 @@ class Query { return cell_val_num == TILEDB_VAR_NUM; } +#ifndef TILEDB_REMOVE_DEPRECATIONS /** * Sets a buffer for a fixed-sized attribute. * @@ -2485,6 +1226,7 @@ class Query { &std::get<0>(buff_sizes_[attr]))); return *this; } +#endif // TILEDB_REMOVE_DEPRECATIONS /** * Sets the data for a fixed/var-sized attribute/dimension. @@ -2521,6 +1263,7 @@ class Query { return *this; } +#ifndef TILEDB_REMOVE_DEPRECATIONS /** * Sets a buffer for a nullable, fixed-sized attribute. * @@ -2610,6 +1353,7 @@ class Query { &std::get<2>(buff_sizes_[attr]))); return *this; } +#endif // TILEDB_REMOVE_DEPRECATIONS }; /* ********************************* */ diff --git a/include/tiledb/query_deprecated.h b/include/tiledb/query_deprecated.h new file mode 100644 index 0000000..87a16ce --- /dev/null +++ b/include/tiledb/query_deprecated.h @@ -0,0 +1,1298 @@ +/** + * @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; +} diff --git a/include/tiledb/tiledb.h b/include/tiledb/tiledb.h index 39e5048..b7f9e38 100644 --- a/include/tiledb/tiledb.h +++ b/include/tiledb/tiledb.h @@ -5,7 +5,7 @@ * * The MIT License * - * @copyright Copyright (c) 2017-2023 TileDB, Inc. + * @copyright Copyright (c) 2017-2024 TileDB, Inc. * @copyright Copyright (c) 2016 MIT and Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a copy @@ -624,38 +624,6 @@ TILEDB_EXPORT int32_t tiledb_array_schema_load( const char* array_uri, tiledb_array_schema_t** array_schema) TILEDB_NOEXCEPT; -/** - * 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; - /** * Retrieves the array type. * @@ -1041,36 +1009,6 @@ TILEDB_EXPORT int32_t tiledb_query_get_config( tiledb_ctx_t* ctx, tiledb_query_t* query, tiledb_config_t** config) 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; /** * Indicates that the query will write or read a subarray, and provides @@ -1458,57 +1396,6 @@ TILEDB_EXPORT void tiledb_query_free(tiledb_query_t** query) TILEDB_NOEXCEPT; TILEDB_EXPORT int32_t tiledb_query_submit(tiledb_ctx_t* ctx, tiledb_query_t* query) 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; - /** * Checks if the query has returned any results. Applicable only to * read queries; it sets `has_results` to `0 in the case of writes. @@ -1610,360 +1497,6 @@ TILEDB_EXPORT int32_t tiledb_query_get_array( tiledb_ctx_t* ctx, tiledb_query_t* query, tiledb_array_t** array) 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; /** * Retrieves the estimated result size for a fixed-sized attribute/dimension. @@ -2949,34 +2482,6 @@ TILEDB_EXPORT int32_t tiledb_array_get_open_timestamp_end( tiledb_array_t* array, uint64_t* timestamp_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; - /** * Deletes array fragments written between the input timestamps. * @@ -3252,36 +2757,6 @@ TILEDB_EXPORT int32_t tiledb_array_create( const char* array_uri, const tiledb_array_schema_t* array_schema) 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 @@ -3309,40 +2784,6 @@ TILEDB_EXPORT int32_t tiledb_array_consolidate( const char* array_uri, tiledb_config_t* config) 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; - /** * Cleans up the array, such as consolidated fragments and array metadata. * Note that this will coarsen the granularity of time traveling (see docs @@ -3367,7 +2808,12 @@ TILEDB_EXPORT int32_t tiledb_array_vacuum( /** * Retrieves the non-empty domain from an array. This is the union of the - * non-empty domains of the array fragments. + * non-empty domains of the array fragments. This API only works for arrays that + * have numeric dimensions and all dimensions of the same type. + * + * The domain passed in is memory that can contain the number of dimensions * 2 + * * sizeof(type of dimension). The previous two is because we return the non + * empty domain as min/max. Dimensions are returned in order. * * **Example:** * @@ -4134,29 +3580,6 @@ TILEDB_EXPORT int32_t tiledb_fragment_info_get_config( TILEDB_EXPORT int32_t tiledb_fragment_info_load( tiledb_ctx_t* ctx, tiledb_fragment_info_t* fragment_info) 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; - /** * Gets the name of a fragment. * @@ -4932,4 +4355,11 @@ TILEDB_EXPORT int32_t tiledb_fragment_info_dump( } #endif +/* ********************************* */ +/* DEPRECATED API */ +/* ********************************* */ +#ifndef TILEDB_REMOVE_DEPRECATIONS +#include "tiledb_deprecated.h" +#endif // TILEDB_REMOVE_DEPRECATIONS + #endif // TILEDB_H diff --git a/include/tiledb/tiledb_deprecated.h b/include/tiledb/tiledb_deprecated.h new file mode 100644 index 0000000..f758513 --- /dev/null +++ b/include/tiledb/tiledb_deprecated.h @@ -0,0 +1,631 @@ +/* + * @file tiledb_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 + * + * This file declares the deprecated C API for TileDB. + */ + +#ifndef TILEDB_DEPRECATED_H +#define TILEDB_DEPRECATED_H + +#include +#include + +#ifdef __cplusplus +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; + +#ifdef __cplusplus +} +#endif + +#endif // TILEDB_DEPRECATED_H diff --git a/include/tiledb/tiledb_experimental.h b/include/tiledb/tiledb_experimental.h index bebb1c9..399eb9d 100644 --- a/include/tiledb/tiledb_experimental.h +++ b/include/tiledb/tiledb_experimental.h @@ -375,6 +375,7 @@ TILEDB_EXPORT int32_t tiledb_array_schema_add_enumeration( 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). * @@ -393,6 +394,7 @@ TILEDB_EXPORT int32_t tiledb_array_delete(tiledb_ctx_t* ctx, const char* uri) */ 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 /** * Evolve array schema of an array. @@ -519,6 +521,7 @@ 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. @@ -549,6 +552,7 @@ TILEDB_DEPRECATED_EXPORT int32_t tiledb_query_add_point_ranges( 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 @@ -746,7 +750,8 @@ TILEDB_EXPORT capi_return_t tiledb_ctx_alloc_with_error( * @param[in] ctx The TileDB context. * @param[in] array_uri The name of the TileDB array whose metadata will * be consolidated. - * @param[in] fragment_uris URIs of the fragments to consolidate. + * @param[in] fragment_uris Fragment names of the fragments to consolidate. The + * names can be recovered using tiledb_fragment_info_get_fragment_name. * @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/include/tiledb/tiledb_version.h b/include/tiledb/tiledb_version.h index 4b32ddb..2d839be 100644 --- a/include/tiledb/tiledb_version.h +++ b/include/tiledb/tiledb_version.h @@ -27,5 +27,5 @@ */ #define TILEDB_VERSION_MAJOR 2 -#define TILEDB_VERSION_MINOR 22 +#define TILEDB_VERSION_MINOR 23 #define TILEDB_VERSION_PATCH 0 diff --git a/lib/x64-ucrt/libaws-c-auth.a b/lib/x64-ucrt/libaws-c-auth.a index ae3ec5a..d13335b 100644 Binary files a/lib/x64-ucrt/libaws-c-auth.a and b/lib/x64-ucrt/libaws-c-auth.a differ diff --git a/lib/x64-ucrt/libaws-c-cal.a b/lib/x64-ucrt/libaws-c-cal.a index 92aa4a4..d1834ef 100644 Binary files a/lib/x64-ucrt/libaws-c-cal.a and b/lib/x64-ucrt/libaws-c-cal.a differ diff --git a/lib/x64-ucrt/libaws-c-common.a b/lib/x64-ucrt/libaws-c-common.a index 0934f5c..cc62157 100644 Binary files a/lib/x64-ucrt/libaws-c-common.a and b/lib/x64-ucrt/libaws-c-common.a differ diff --git a/lib/x64-ucrt/libaws-c-compression.a b/lib/x64-ucrt/libaws-c-compression.a index 95dedd4..16d1a27 100644 Binary files a/lib/x64-ucrt/libaws-c-compression.a and b/lib/x64-ucrt/libaws-c-compression.a differ diff --git a/lib/x64-ucrt/libaws-c-event-stream.a b/lib/x64-ucrt/libaws-c-event-stream.a index 4c1134f..048ff28 100644 Binary files a/lib/x64-ucrt/libaws-c-event-stream.a and b/lib/x64-ucrt/libaws-c-event-stream.a differ diff --git a/lib/x64-ucrt/libaws-c-http.a b/lib/x64-ucrt/libaws-c-http.a index e40ff8a..6ebdb45 100644 Binary files a/lib/x64-ucrt/libaws-c-http.a and b/lib/x64-ucrt/libaws-c-http.a differ diff --git a/lib/x64-ucrt/libaws-c-io.a b/lib/x64-ucrt/libaws-c-io.a index d87ea95..e518de3 100644 Binary files a/lib/x64-ucrt/libaws-c-io.a and b/lib/x64-ucrt/libaws-c-io.a differ diff --git a/lib/x64-ucrt/libaws-c-mqtt.a b/lib/x64-ucrt/libaws-c-mqtt.a index 8db7efe..7b50e9b 100644 Binary files a/lib/x64-ucrt/libaws-c-mqtt.a and b/lib/x64-ucrt/libaws-c-mqtt.a differ diff --git a/lib/x64-ucrt/libaws-c-s3.a b/lib/x64-ucrt/libaws-c-s3.a index 44a74f4..3c37508 100644 Binary files a/lib/x64-ucrt/libaws-c-s3.a and b/lib/x64-ucrt/libaws-c-s3.a differ diff --git a/lib/x64-ucrt/libaws-c-sdkutils.a b/lib/x64-ucrt/libaws-c-sdkutils.a index 83ec046..4c946cf 100644 Binary files a/lib/x64-ucrt/libaws-c-sdkutils.a and b/lib/x64-ucrt/libaws-c-sdkutils.a differ diff --git a/lib/x64-ucrt/libaws-checksums.a b/lib/x64-ucrt/libaws-checksums.a index e7ecd6c..a07f765 100644 Binary files a/lib/x64-ucrt/libaws-checksums.a and b/lib/x64-ucrt/libaws-checksums.a differ diff --git a/lib/x64-ucrt/libaws-cpp-sdk-access-management.a b/lib/x64-ucrt/libaws-cpp-sdk-access-management.a index 2210e93..a8c99cd 100644 Binary files a/lib/x64-ucrt/libaws-cpp-sdk-access-management.a and b/lib/x64-ucrt/libaws-cpp-sdk-access-management.a differ diff --git a/lib/x64-ucrt/libaws-cpp-sdk-cognito-identity.a b/lib/x64-ucrt/libaws-cpp-sdk-cognito-identity.a index 1df2f31..6820991 100644 Binary files a/lib/x64-ucrt/libaws-cpp-sdk-cognito-identity.a and b/lib/x64-ucrt/libaws-cpp-sdk-cognito-identity.a differ diff --git a/lib/x64-ucrt/libaws-cpp-sdk-core.a b/lib/x64-ucrt/libaws-cpp-sdk-core.a index d9c22a8..e796eb7 100644 Binary files a/lib/x64-ucrt/libaws-cpp-sdk-core.a and b/lib/x64-ucrt/libaws-cpp-sdk-core.a differ diff --git a/lib/x64-ucrt/libaws-cpp-sdk-iam.a b/lib/x64-ucrt/libaws-cpp-sdk-iam.a index 41bf909..06209b5 100644 Binary files a/lib/x64-ucrt/libaws-cpp-sdk-iam.a and b/lib/x64-ucrt/libaws-cpp-sdk-iam.a differ diff --git a/lib/x64-ucrt/libaws-cpp-sdk-identity-management.a b/lib/x64-ucrt/libaws-cpp-sdk-identity-management.a index 6ad8225..e720840 100644 Binary files a/lib/x64-ucrt/libaws-cpp-sdk-identity-management.a and b/lib/x64-ucrt/libaws-cpp-sdk-identity-management.a differ diff --git a/lib/x64-ucrt/libaws-cpp-sdk-s3.a b/lib/x64-ucrt/libaws-cpp-sdk-s3.a index 98fdbe7..799495b 100644 Binary files a/lib/x64-ucrt/libaws-cpp-sdk-s3.a and b/lib/x64-ucrt/libaws-cpp-sdk-s3.a differ diff --git a/lib/x64-ucrt/libaws-cpp-sdk-sts.a b/lib/x64-ucrt/libaws-cpp-sdk-sts.a index 14a3b33..2c5ef35 100644 Binary files a/lib/x64-ucrt/libaws-cpp-sdk-sts.a and b/lib/x64-ucrt/libaws-cpp-sdk-sts.a differ diff --git a/lib/x64-ucrt/libaws-crt-cpp.a b/lib/x64-ucrt/libaws-crt-cpp.a index efe9600..8a897c2 100644 Binary files a/lib/x64-ucrt/libaws-crt-cpp.a and b/lib/x64-ucrt/libaws-crt-cpp.a differ diff --git a/lib/x64-ucrt/libbz2.a b/lib/x64-ucrt/libbz2.a index e67d6ea..8ed75a7 100644 Binary files a/lib/x64-ucrt/libbz2.a and b/lib/x64-ucrt/libbz2.a differ diff --git a/lib/x64-ucrt/libfmt.a b/lib/x64-ucrt/libfmt.a index 351a4ff..3a44682 100644 Binary files a/lib/x64-ucrt/libfmt.a and b/lib/x64-ucrt/libfmt.a differ diff --git a/lib/x64-ucrt/liblibmagic.a b/lib/x64-ucrt/liblibmagic.a index a8c5d37..5d0f6f5 100644 Binary files a/lib/x64-ucrt/liblibmagic.a and b/lib/x64-ucrt/liblibmagic.a differ diff --git a/lib/x64-ucrt/liblz4.a b/lib/x64-ucrt/liblz4.a index 0374583..22101fe 100644 Binary files a/lib/x64-ucrt/liblz4.a and b/lib/x64-ucrt/liblz4.a differ diff --git a/lib/x64-ucrt/libpcre2-16.a b/lib/x64-ucrt/libpcre2-16.a index 3615d0a..9c1ba24 100644 Binary files a/lib/x64-ucrt/libpcre2-16.a and b/lib/x64-ucrt/libpcre2-16.a differ diff --git a/lib/x64-ucrt/libpcre2-32.a b/lib/x64-ucrt/libpcre2-32.a index 9de180c..06e1b23 100644 Binary files a/lib/x64-ucrt/libpcre2-32.a and b/lib/x64-ucrt/libpcre2-32.a differ diff --git a/lib/x64-ucrt/libpcre2-8.a b/lib/x64-ucrt/libpcre2-8.a index 2447635..b93acab 100644 Binary files a/lib/x64-ucrt/libpcre2-8.a and b/lib/x64-ucrt/libpcre2-8.a differ diff --git a/lib/x64-ucrt/libpcre2-posix.a b/lib/x64-ucrt/libpcre2-posix.a index 7c0917c..9a83e8f 100644 Binary files a/lib/x64-ucrt/libpcre2-posix.a and b/lib/x64-ucrt/libpcre2-posix.a differ diff --git a/lib/x64-ucrt/libsharpyuv.a b/lib/x64-ucrt/libsharpyuv.a index c510bb0..d324204 100644 Binary files a/lib/x64-ucrt/libsharpyuv.a and b/lib/x64-ucrt/libsharpyuv.a differ diff --git a/lib/x64-ucrt/libspdlog.a b/lib/x64-ucrt/libspdlog.a index 899dfae..491ddfc 100644 Binary files a/lib/x64-ucrt/libspdlog.a and b/lib/x64-ucrt/libspdlog.a differ diff --git a/lib/x64-ucrt/libtiledbstatic.a b/lib/x64-ucrt/libtiledbstatic.a index 404994e..84845b2 100644 Binary files a/lib/x64-ucrt/libtiledbstatic.a and b/lib/x64-ucrt/libtiledbstatic.a differ diff --git a/lib/x64-ucrt/libwebp.a b/lib/x64-ucrt/libwebp.a index ed50484..30a5060 100644 Binary files a/lib/x64-ucrt/libwebp.a and b/lib/x64-ucrt/libwebp.a differ diff --git a/lib/x64-ucrt/libwebpdecoder.a b/lib/x64-ucrt/libwebpdecoder.a index e209be6..1d82a59 100644 Binary files a/lib/x64-ucrt/libwebpdecoder.a and b/lib/x64-ucrt/libwebpdecoder.a differ diff --git a/lib/x64-ucrt/libwebpdemux.a b/lib/x64-ucrt/libwebpdemux.a index 13a11b8..f6e858e 100644 Binary files a/lib/x64-ucrt/libwebpdemux.a and b/lib/x64-ucrt/libwebpdemux.a differ diff --git a/lib/x64-ucrt/libwebpmux.a b/lib/x64-ucrt/libwebpmux.a index 88e01ac..dd357d1 100644 Binary files a/lib/x64-ucrt/libwebpmux.a and b/lib/x64-ucrt/libwebpmux.a differ diff --git a/lib/x64-ucrt/libzlib.a b/lib/x64-ucrt/libzlib.a index a6f4272..78708d8 100644 Binary files a/lib/x64-ucrt/libzlib.a and b/lib/x64-ucrt/libzlib.a differ diff --git a/lib/x64-ucrt/libzstd.a b/lib/x64-ucrt/libzstd.a index c717bf5..a24c13c 100644 Binary files a/lib/x64-ucrt/libzstd.a and b/lib/x64-ucrt/libzstd.a differ