-
Notifications
You must be signed in to change notification settings - Fork 202
feat: [sc-58279] [core] add tiledb_array_schema_get_enumeration API
#5359
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
b484eb6
Add tiledb_array_schema_get_enumeration API
rroelke c1efcf0
Fix comment typo
rroelke 0a77551
Move is_equivalent_enumeration to array_schema_helpers.cc
rroelke dc2b5ae
Fix missing return code
rroelke 5d5c3ba
Add missing rest tag
rroelke d18cb94
Fix formatting
rroelke 0bf188d
tiledb_array_schema_get_enumeration => tiledb_array_schema_get_enumer…
rroelke 754f239
Undo default argument, add ArraySchema::load_schema_with_config
rroelke 2c2de31
Split ArraySchema::get_enumeration to look up from enumeration name o…
rroelke adfcfea
ArraySchema::load_enumeration branch for remote array case
rroelke efc7cea
ArraySchema enumeration tests pass with REST server
rroelke 2eeda89
Move schema enumeration loading code to different compilation unit
rroelke 9454c21
Fix linking issues
rroelke 1f09625
Revert array_operations changes
rroelke d42551e
Revert no-longer-used includes
rroelke b9a5b46
Remove C4459 errors
rroelke 4008d80
Fix duplicate definitions in unit_capi_array_schema
rroelke f13411d
Fix unit_capi_array linker errors
rroelke 7b42669
Fix platform-dependent SEGV from passing NULL attribute name to tiled…
rroelke 7ba3f5e
Merge remote-tracking branch 'origin/dev' into rr/sc-58279-tiledb-arr…
rroelke f0727b9
Update tiledb/api/c_api/array_schema/array_schema_api_experimental.h
rroelke 85ffae9
Update tiledb/api/c_api/array_schema/array_schema_api_experimental.h
rroelke 373c4c2
Update tiledb/sm/rest/rest_client_remote.h
rroelke 2967b0d
Update tiledb/api/c_api/array_schema/array_schema_api_experimental.h
rroelke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| /** | ||
| * @file array_schema_helpers.cc | ||
| * | ||
| * @section LICENSE | ||
| * | ||
| * The MIT License | ||
| * | ||
| * @copyright Copyright (c) 2017-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 defines some array schema test suite helper functions. | ||
| */ | ||
|
|
||
| #include "test/support/src/array_schema_helpers.h" | ||
| #include "tiledb/api/c_api/enumeration/enumeration_api_internal.h" | ||
| #include "tiledb/sm/array_schema/enumeration.h" | ||
| #include "tiledb/sm/cpp_api/tiledb" | ||
|
|
||
| using namespace tiledb; | ||
|
|
||
| namespace tiledb::test { | ||
|
|
||
| bool is_equivalent_enumeration( | ||
| const Enumeration& left, const Enumeration& right) { | ||
| return left.name() == right.name() && left.type() == right.type() && | ||
| left.cell_val_num() == right.cell_val_num() && | ||
| left.ordered() == right.ordered() && | ||
| std::equal( | ||
| left.ptr()->data().begin(), | ||
| left.ptr()->data().end(), | ||
| right.ptr()->data().begin(), | ||
| right.ptr()->data().end()); | ||
| } | ||
|
|
||
| } // namespace tiledb::test | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| /** | ||
| * @file array_schema_helpers.h | ||
| * | ||
| * @section LICENSE | ||
| * | ||
| * The MIT License | ||
| * | ||
| * @copyright Copyright (c) 2017-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 some array schema test suite helper functions. | ||
| */ | ||
|
|
||
| #ifndef TILEDB_TEST_ARRAY_SCHEMA_HELPERS_H | ||
| #define TILEDB_TEST_ARRAY_SCHEMA_HELPERS_H | ||
|
|
||
| #include "tiledb/sm/cpp_api/tiledb" | ||
| #include "tiledb/sm/cpp_api/tiledb_experimental" | ||
|
|
||
| namespace tiledb::test { | ||
|
|
||
| /** | ||
| * @return if two enumerations `left` and `right` are equivalent, | ||
| * i.e. have the same name, datatype, variants, etc | ||
| */ | ||
| bool is_equivalent_enumeration( | ||
| const tiledb::Enumeration& left, const tiledb::Enumeration& right); | ||
|
|
||
| } // namespace tiledb::test | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -717,6 +717,32 @@ class Array { | |
| return ArraySchema(ctx, schema); | ||
| } | ||
|
|
||
| /** | ||
| * Loads the array schema from an array. | ||
| * Options to load additional features are read from the optionally-provided | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| * `config`. See `tiledb_array_schema_load_with_config`. | ||
| * | ||
| * **Example:** | ||
| * @code{.cpp} | ||
| * 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. | ||
| * @return The loaded ArraySchema object. | ||
| */ | ||
| 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( | ||
rroelke marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ctx.ptr().get(), config.ptr().get(), uri.c_str(), &schema)); | ||
| return ArraySchema(ctx, schema); | ||
| } | ||
|
|
||
| /** | ||
| * Gets the encryption type the given array was created with. | ||
| * | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for putting this here, I'm likely going to use it when you merge