Skip to content

Commit

Permalink
Undo default argument, add ArraySchema::load_schema_with_config
Browse files Browse the repository at this point in the history
  • Loading branch information
rroelke committed Oct 25, 2024
1 parent 0bf188d commit 754f239
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
2 changes: 1 addition & 1 deletion test/src/unit-cppapi-enumerations.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
32 changes: 26 additions & 6 deletions tiledb/sm/cpp_api/array.h
Original file line number Diff line number Diff line change
Expand Up @@ -697,26 +697,46 @@ 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
* `config`. See `tiledb_array_schema_load_with_config`.
*
* **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));
Expand Down

0 comments on commit 754f239

Please sign in to comment.