Skip to content

Commit

Permalink
extract another method
Browse files Browse the repository at this point in the history
  • Loading branch information
johnkerl committed Aug 18, 2024
1 parent 43f9f96 commit 3c40acf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
5 changes: 2 additions & 3 deletions libtiledbsoma/src/soma/soma_array.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1178,14 +1178,13 @@ uint64_t SOMAArray::nnz_slow() {
}

std::vector<int64_t> SOMAArray::shape() {
// Two reasons for this:
// There are two reasons for this:
// * Transitional, non-monolithic, phased, careful development for the
// new-shape feature
// * Even after the new-shape feature is fully released, there will be old
// arrays on disk that were created before this feature existed.
// So this is long-term code.
auto current_domain = tiledb::ArraySchemaExperimental::current_domain(
*ctx_->tiledb_ctx(), arr_->schema());
auto current_domain = _get_current_domain();
if (current_domain.is_empty()) {
return _tiledb_domain();
} else {
Expand Down
12 changes: 12 additions & 0 deletions libtiledbsoma/src/soma/soma_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,18 @@ class SOMAArray : public SOMAObject {

uint64_t _get_max_capacity(tiledb_datatype_t index_type);

/**
* The caller must check the return value for .is_empty() to see if this is
* a new-style array with current-domain support (.is_empty() is false) , or
* an old-style array without current-domain support (.is_empty() is true).
* We could implement this as a std::optional<CurrentDomain> return value
* here, but, that would be a redundant indicator.
*/
CurrentDomain _get_current_domain() {
return tiledb::ArraySchemaExperimental::current_domain(
*ctx_->tiledb_ctx(), arr_->schema());
}

/**
* With old shape: core domain mapped to tiledbsoma shape; core current
* domain did not exist.
Expand Down

0 comments on commit 3c40acf

Please sign in to comment.