Skip to content

chore: Remove Status from ArraySchema, Attribute, Dimension, Domain #5541

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 9 commits into from
Jun 18, 2025

Conversation

rroelke
Copy link
Member

@rroelke rroelke commented Jun 11, 2025

There are a number of old stories which refer to "un-Statusing" various parts of the code. I can imagine some benefits of doing this, but a new one concerns our upcoming interoperability with Rust code.

The Rust crate we use to interoperate with C++, cxx, can generate idiomatic bindings in Rust to use types and call functions which are defined in C++. These bindings can declare and use "opaque" types, i.e. types whose definitions reside within C++ and are invisible to Rust code. However, these types cannot be passed by value to and from Rust functions.

Status is commonly used as a return value from our internal C++ code. This prevents us from declaring bindings for those functions in cxx and thus calling them from Rust. We probably cannot migrate Status from an opaque type to a shared type, but we can "un-Status" the functions we want to use.

This pull request "un-Statuses" the methods of classes in the array_schema directory. This will eventually allow them to be called from Rust code.


TYPE: NO_HISTORY
DESC: Un-Status array_schema methods

@rroelke rroelke requested a review from bekadavis9 June 11, 2025 00:57
@@ -515,25 +512,25 @@ class ArraySchema {
* Sets whether the array allows coordinate duplicates.
* It errors out if set to `1` for dense arrays.
*/
Status set_allows_dups(bool allows_dups);
void set_allows_dups(bool allows_dups);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above. Should return bool. I won't continue to mark the rest of these for both of our sake :')

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only has_dimension and has_attribute have value which can now be return this way, the other affected functions do not have out arguments.

if (domain == nullptr) {
return;
}
throw DimensionException(
std::string("Setting the domain to a dimension with type '") +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: no need to cast the exception body to std::string. Rings true throughout PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed for the concatenation

Copy link
Member

@teo-tsirpanis teo-tsirpanis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Comment on lines +201 to 218
echo "START tiledb_regression"
./test/regression/tiledb_regression -d yes
echo "END tiledb_regression"

echo "START tiledb_regression"
./test/ci/test_assert -d yes
echo "END tiledb_regression"

echo "START tiledb_unit"
./test/tiledb_unit -d yes "~[rapidcheck]" | awk '/1: ::set-output/{sub(/.*1: /, ""); print; next} 1'
echo "END tiledb_unit"

echo "START unit_vfs"
./tiledb/sm/filesystem/test/unit_vfs -d yes | awk '/1: ::set-output/{sub(/.*1: /, ""); print; next} 1'
echo "END unit_vfs"

# Run rapidcheck tests as their own process so we can see the random seed for each
./test/tiledb_unit --list-tests "[rapidcheck]" --verbosity quiet | while IFS= read -r testname; do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
echo "START tiledb_regression"
./test/regression/tiledb_regression -d yes
echo "END tiledb_regression"
echo "START tiledb_regression"
./test/ci/test_assert -d yes
echo "END tiledb_regression"
echo "START tiledb_unit"
./test/tiledb_unit -d yes "~[rapidcheck]" | awk '/1: ::set-output/{sub(/.*1: /, ""); print; next} 1'
echo "END tiledb_unit"
echo "START unit_vfs"
./tiledb/sm/filesystem/test/unit_vfs -d yes | awk '/1: ::set-output/{sub(/.*1: /, ""); print; next} 1'
echo "END unit_vfs"
# Run rapidcheck tests as their own process so we can see the random seed for each
./test/tiledb_unit --list-tests "[rapidcheck]" --verbosity quiet | while IFS= read -r testname; do
echo "START tiledb_regression"
./test/regression/tiledb_regression -d yes
echo "START tiledb_regression"
./test/ci/test_assert -d yes
echo "START tiledb_unit"
./test/tiledb_unit -d yes "~[rapidcheck]" | awk '/1: ::set-output/{sub(/.*1: /, ""); print; next} 1'
echo "START unit_vfs"
./tiledb/sm/filesystem/test/unit_vfs -d yes | awk '/1: ::set-output/{sub(/.*1: /, ""); print; next} 1'
# Run rapidcheck tests as their own process so we can see the random seed for each
echo "START tiledb_unit rapidcheck"
./test/tiledb_unit --list-tests "[rapidcheck]" --verbosity quiet | while IFS= read -r testname; do

We don't need both start and end messages, since starting an operation implies that the previous one ended.

Comment on lines +41 to +42
"[TileDB::Dimension] Error: Dimension: Coordinate -682.75 is out of "
"domain bounds [-682.73999, 929.42999] on dimension 'Z'");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing to do for this PR, but the format of our error messages has lots of room for improvement.

Comment on lines +876 to +881
if (std::isinf(domain[0]) || std::isinf(domain[1])) {
throw DimensionException("Domain check failed; domain contains NaN");
}
if (std::isnan(domain[0]) || std::isnan(domain[1])) {
throw DimensionException("Domain check failed; domain contains NaN");
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (std::isinf(domain[0]) || std::isinf(domain[1])) {
throw DimensionException("Domain check failed; domain contains NaN");
}
if (std::isnan(domain[0]) || std::isnan(domain[1])) {
throw DimensionException("Domain check failed; domain contains NaN");
}
if (!(std::isfinite(domain[0]) && std::isfinite(domain[1]))) {
throw DimensionException("Domain check failed; domain cannot contain NaN or Infinity");
}

@rroelke rroelke merged commit b68faea into main Jun 18, 2025
107 of 108 checks passed
@rroelke rroelke deleted the rr/cleanup-array-schema-Status branch June 18, 2025 02:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants