Skip to content

Commit

Permalink
Add Enumerated Data Types
Browse files Browse the repository at this point in the history
TODO: Write a better commit message
  • Loading branch information
davisp committed May 2, 2023
1 parent 8afb588 commit c15874e
Show file tree
Hide file tree
Showing 52 changed files with 3,596 additions and 91 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ else()
elseif (CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo")
add_compile_options(-DNDEBUG -O3 -g3 -ggdb3 -gdwarf-3)
elseif (CMAKE_BUILD_TYPE MATCHES "Coverage")
add_compile_options(-DDEBUG -g3 -gdwarf-3 --coverage)
add_compile_options(-DDEBUG --coverage -fprofile-instr-generate -fcoverage-mapping)
add_link_options(--coverage -fprofile-instr-generate -fcoverage-mapping)
endif()

# Use -Wno-literal-suffix on Linux with C++ sources.
Expand Down
27 changes: 27 additions & 0 deletions PJD_TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Chores Left
===

* Testing
* Update C API unit tests to cover 100% of the Enumeration constructor
* Throw error if enumeration has longer length than the integer width of the attribute
* Require the attribute type to be integral when setting an enumeration
* Don't allow signed integer values for attributes with enumeratiojns? Does R need this?
* Require cell_val_num == 1 for attributes

* Errors (de?)serializing to disk

* Miscellany
* Add Enumeration::dump(FILE* out)
* Update schema consolidation and vaccuming for enumerations
* When serializing array schema, check that any enumerations set on attributes actually exist
* Array::get_enumeration - might have to check all load schema versions?
* Do loaded enumerations need serialized?
* QueryAstNode rewrite_enumeration_condition - Need to adjust bit widths
* Document enumeration format changes in the storage format docs

* REST Serialization ToDOs
* Enumerations initial implementation
* Add ASTNode::use_enumeration to serialization code - If not, all remote queries are against enumeration values
* Add attribute enumeration name


1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ if (TILEDB_CPP_API)
src/unit-cppapi-datetimes.cc
src/unit-cppapi-deletes.cc
src/unit-cppapi-dense-qc-coords-mode.cc
src/unit-cppapi-enumerations.cc
src/unit-cppapi-time.cc
src/unit-cppapi-fill_values.cc
src/unit-cppapi-filter.cc
Expand Down
36 changes: 28 additions & 8 deletions test/src/unit-cppapi-deletes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ struct DeletesFx {
void remove_sparse_array();
void remove_array(const std::string& array_name);
bool is_array(const std::string& array_name);
std::vector<std::string> list_schemas(const std::string& array_name);
};

DeletesFx::DeletesFx()
Expand Down Expand Up @@ -488,6 +489,29 @@ bool DeletesFx::is_array(const std::string& array_name) {
return vfs_.is_dir(array_name);
}

std::vector<std::string> DeletesFx::list_schemas(
const std::string& array_name) {
auto& enum_dir = tiledb::sm::constants::array_enumerations_dir_name;
auto schemas =
vfs_.ls(array_name + "/" + tiledb::sm::constants::array_schema_dir_name);

auto it = schemas.begin();
while (it != schemas.end()) {
if ((*it).size() < enum_dir.size()) {
continue;
}
if ((*it).substr((*it).size() - enum_dir.size()) == enum_dir) {
break;
}
++it;
}
if (it != schemas.end()) {
schemas.erase(it);
}

return schemas;
}

TEST_CASE_METHOD(
DeletesFx,
"CPP API: Test writing delete condition",
Expand Down Expand Up @@ -1949,8 +1973,7 @@ TEST_CASE_METHOD(
// Check write
CHECK(tiledb::test::num_commits(SPARSE_ARRAY_NAME) == 4);
CHECK(tiledb::test::num_fragments(SPARSE_ARRAY_NAME) == 4);
auto schemas =
vfs_.ls(array_name + "/" + tiledb::sm::constants::array_schema_dir_name);
auto schemas = list_schemas(array_name);
CHECK(schemas.size() == 1);
auto meta = vfs_.ls(
array_name + "/" + tiledb::sm::constants::array_metadata_dir_name);
Expand Down Expand Up @@ -1984,8 +2007,7 @@ TEST_CASE_METHOD(
// Check working directory after delete
REQUIRE(vfs_.is_file(extraneous_file_path));
CHECK(tiledb::test::num_fragments(SPARSE_ARRAY_NAME) == 0);
schemas =
vfs_.ls(array_name + "/" + tiledb::sm::constants::array_schema_dir_name);
schemas = list_schemas(array_name);
CHECK(schemas.size() == 0);
meta = vfs_.ls(
array_name + "/" + tiledb::sm::constants::array_metadata_dir_name);
Expand Down Expand Up @@ -2042,8 +2064,7 @@ TEST_CASE_METHOD(
vfs_.touch(extraneous_file_path);

// Check write
auto schemas =
vfs_.ls(array_name + "/" + tiledb::sm::constants::array_schema_dir_name);
auto schemas = list_schemas(array_name);
CHECK(schemas.size() == 1);
auto uris = vfs_.ls(array_name);
bool ok_exists = false;
Expand Down Expand Up @@ -2072,8 +2093,7 @@ TEST_CASE_METHOD(
CHECK(!tiledb::sm::utils::parse::starts_with(uri, ok_prefix));
}
REQUIRE(vfs_.is_file(extraneous_file_path));
schemas =
vfs_.ls(array_name + "/" + tiledb::sm::constants::array_schema_dir_name);
schemas = list_schemas(array_name);
CHECK(schemas.size() == 0);

remove_sparse_array();
Expand Down
Loading

0 comments on commit c15874e

Please sign in to comment.