From 754f239e45aded90878acbcb3434a908d67e2eed Mon Sep 17 00:00:00 2001 From: Ryan Roelke Date: Thu, 24 Oct 2024 21:39:44 -0400 Subject: [PATCH] Undo default argument, add ArraySchema::load_schema_with_config --- test/src/unit-cppapi-enumerations.cc | 2 +- tiledb/sm/cpp_api/array.h | 32 ++++++++++++++++++++++------ 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/test/src/unit-cppapi-enumerations.cc b/test/src/unit-cppapi-enumerations.cc index bfdb1c9b1d6..814699429a7 100644 --- a/test/src/unit-cppapi-enumerations.cc +++ b/test/src/unit-cppapi-enumerations.cc @@ -363,7 +363,7 @@ TEST_CASE_METHOD( Config config; config["rest.load_enumerations_on_array_open"] = "true"; - auto schema = Array::load_schema(ctx_, uri_, config); + auto schema = Array::load_schema_with_config(ctx_, config, uri_); auto enmr = ArraySchemaExperimental::get_enumeration_if_loaded( ctx_, schema, "an_enumeration"); REQUIRE(enmr.has_value()); diff --git a/tiledb/sm/cpp_api/array.h b/tiledb/sm/cpp_api/array.h index 06caa4e45d7..1b21340d9a5 100644 --- a/tiledb/sm/cpp_api/array.h +++ b/tiledb/sm/cpp_api/array.h @@ -697,6 +697,26 @@ class Array { create(schema.context(), uri, schema); } + /** + * Loads the array schema from an array. + * + * **Example:** + * @code{.cpp} + * auto schema = tiledb::Array::load_schema(ctx, + * "s3://bucket-name/array-name"); + * @endcode + * + * @param ctx The TileDB context. + * @param uri The array URI. + * @return The loaded ArraySchema object. + */ + static ArraySchema load_schema(const Context& ctx, const std::string& uri) { + tiledb_array_schema_t* schema; + ctx.handle_error( + tiledb_array_schema_load(ctx.ptr().get(), uri.c_str(), &schema)); + return ArraySchema(ctx, schema); + } + /** * Loads the array schema from an array. * Options to load additional features are read from the optionally-provided @@ -704,19 +724,19 @@ class Array { * * **Example:** * @code{.cpp} - * auto schema = tiledb::Array::load_schema(ctx, + * tiledb::Config config; + * config["rest.load_enumerations_on_array_open"] = "true"; + * auto schema = tiledb::Array::load_schema_with_config(ctx, config, * "s3://bucket-name/array-name"); * @endcode * * @param ctx The TileDB context. + * @param config The request for additional features. * @param uri The array URI. - * @param config The optional request for additional features. * @return The loaded ArraySchema object. */ - static ArraySchema load_schema( - const Context& ctx, - const std::string& uri, - const Config& config = Config()) { + static ArraySchema load_schema_with_config( + const Context& ctx, const Config& config, const std::string& uri) { tiledb_array_schema_t* schema; ctx.handle_error(tiledb_array_schema_load_with_config( ctx.ptr().get(), config.ptr().get(), uri.c_str(), &schema));