Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove tiledb_array_schema_load_with_enumerations #4304

Merged
merged 2 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions ports/libxml2/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
vcpkg_from_gitlab(
GITLAB_URL https://gitlab.gnome.org/
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO GNOME/libxml2
REF f507d167f1755b7eaea09fb1a44d29aab828b6d1
Expand Down
19 changes: 0 additions & 19 deletions test/src/unit-cppapi-enumerations.cc
Original file line number Diff line number Diff line change
Expand Up @@ -135,25 +135,6 @@ TEST_CASE_METHOD(
schema.add_attribute(attr);
}

TEST_CASE_METHOD(
CPPEnumerationFx,
"CPP: Load Schema from URI",
"[enumeration][add-attribute]") {
create_array();
auto schema = ArraySchemaExperimental::load_with_enumerations(ctx_, uri_);
auto enmr_names =
schema.ptr().get()->array_schema_->get_loaded_enumeration_names();
REQUIRE(enmr_names.size() > 0);
}

TEST_CASE_METHOD(
CPPEnumerationFx,
"CPP: Load Schema from URI - REMOTE NOT SUPPORTED YET",
"[enumeration][add-attribute][fixme]") {
std::string uri = "tiledb://namespace/array_name";
REQUIRE_THROWS(ArraySchemaExperimental::load_with_enumerations(ctx_, uri));
}

TEST_CASE_METHOD(
CPPEnumerationFx,
"CPP: Schema Dump With Enumeration",
Expand Down
42 changes: 7 additions & 35 deletions tiledb/sm/c_api/tiledb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -453,10 +453,9 @@ int32_t tiledb_array_schema_check(
return TILEDB_OK;
}

int32_t tiledb_array_schema_load_impl(
int32_t tiledb_array_schema_load(
tiledb_ctx_t* ctx,
const char* array_uri,
int with_enumerations,
tiledb_array_schema_t** array_schema) {
if (sanity_check(ctx) == TILEDB_ERR)
return TILEDB_ERR;
Expand Down Expand Up @@ -490,23 +489,12 @@ int32_t tiledb_array_schema_load_impl(
return TILEDB_ERR;
}

// With enumerations not supported for remote arrays currently.
if (with_enumerations) {
delete *array_schema;
*array_schema = nullptr;
auto st = Status_Error(
"Failed to load array schema;"
"remote load with enumerations is not yet supported.");
LOG_STATUS_NO_RETURN_VALUE(st);
save_error(ctx, st);
return TILEDB_ERR;
}

auto&& [st, array_schema_rest] =
rest_client->get_array_schema_from_rest(uri);
if (!st.ok()) {
LOG_STATUS_NO_RETURN_VALUE(st);
save_error(ctx, st);
delete *array_schema;
return TILEDB_ERR;
}
(*array_schema)->array_schema_ = array_schema_rest.value();
Expand All @@ -532,21 +520,13 @@ int32_t tiledb_array_schema_load_impl(
auto st = Status_ArrayDirectoryError(le.what());
LOG_STATUS_NO_RETURN_VALUE(st);
save_error(ctx, st);
delete *array_schema;
return TILEDB_ERR;
}

// Load latest array schema
try {
auto&& array_schema_latest = array_dir.load_array_schema_latest(key);
if (with_enumerations) {
array_dir.load_all_enumerations(array_schema_latest, key);
}
(*array_schema)->array_schema_ = array_schema_latest;
} catch (...) {
delete *array_schema;
*array_schema = nullptr;
throw;
}
auto&& array_schema_latest = array_dir.load_array_schema_latest(key);
(*array_schema)->array_schema_ = array_schema_latest;
}
return TILEDB_OK;
}
Expand Down Expand Up @@ -5366,16 +5346,8 @@ int32_t tiledb_array_schema_load(
tiledb_ctx_t* ctx,
const char* array_uri,
tiledb_array_schema_t** array_schema) noexcept {
return api_entry<tiledb::api::tiledb_array_schema_load_impl>(
ctx, array_uri, 0, array_schema);
}

int32_t tiledb_array_schema_load_with_enumerations(
tiledb_ctx_t* ctx,
const char* array_uri,
tiledb_array_schema_t** array_schema) noexcept {
return api_entry<tiledb::api::tiledb_array_schema_load_impl>(
ctx, array_uri, 1, array_schema);
return api_entry<tiledb::api::tiledb_array_schema_load>(
ctx, array_uri, array_schema);
}

int32_t tiledb_array_schema_load_with_key(
Expand Down
22 changes: 0 additions & 22 deletions tiledb/sm/c_api/tiledb_experimental.h
Original file line number Diff line number Diff line change
Expand Up @@ -317,28 +317,6 @@ TILEDB_EXPORT int32_t tiledb_array_schema_add_enumeration(
tiledb_array_schema_t* array_schema,
tiledb_enumeration_t* enumeration) TILEDB_NOEXCEPT;

/**
* Retrieves the schema of an array from the disk with all enumerations loaded,
* creating an array schema struct.
*
* **Example:**
*
* @code{.c}
* tiledb_array_schema_t* array_schema;
* tiledb_array_schema_load(ctx, "s3://tiledb_bucket/my_array", &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 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_EXPORT int32_t tiledb_array_schema_load_with_enumerations(
tiledb_ctx_t* ctx,
const char* array_uri,
tiledb_array_schema_t** array_schema) TILEDB_NOEXCEPT;

/* ********************************* */
/* ARRAY */
/* ********************************* */
Expand Down
16 changes: 0 additions & 16 deletions tiledb/sm/cpp_api/array_schema_experimental.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,6 @@
namespace tiledb {
class ArraySchemaExperimental {
public:
/**
* Load an ArraySchema from the given URI with all of its enumerations.
*
* @param ctx The TileDB context.
* @param uri The URI to load from.
* @return ArraySchema The loaded array schema.
*/
static ArraySchema load_with_enumerations(
const Context& ctx, const std::string& uri) {
tiledb_ctx_t* c_ctx = ctx.ptr().get();
tiledb_array_schema_t* schema;
ctx.handle_error(tiledb_array_schema_load_with_enumerations(
c_ctx, uri.c_str(), &schema));
return ArraySchema(ctx, schema);
}

/**
* Adds a DimensionLabel to the array.
*
Expand Down
Loading