Skip to content

Commit

Permalink
Making methods public again.
Browse files Browse the repository at this point in the history
  • Loading branch information
KiterLuc committed Feb 29, 2024
1 parent dd61336 commit c5fbf45
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 44 deletions.
14 changes: 7 additions & 7 deletions tiledb/sm/subarray/range_subset.cc
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,6 @@ tuple<Status, optional<std::string>> RangeSetAndSuperset::add_range(
}
}

void RangeSetAndSuperset::check_oob() {
for (auto& range : ranges_) {
impl_->check_range_is_valid(range);
throw_if_not_ok(impl_->check_range_is_subset(range));
}
}

Status RangeSetAndSuperset::add_range_unrestricted(const Range& range) {
if (is_implicitly_initialized_) {
ranges_.clear();
Expand All @@ -187,4 +180,11 @@ Status RangeSetAndSuperset::add_range_unrestricted(const Range& range) {
return impl_->add_range(ranges_, range);
}

void RangeSetAndSuperset::check_oob() {
for (auto& range : ranges_) {
impl_->check_range_is_valid(range);
throw_if_not_ok(impl_->check_range_is_subset(range));
}
}

} // namespace tiledb::sm
27 changes: 10 additions & 17 deletions tiledb/sm/subarray/range_subset.h
Original file line number Diff line number Diff line change
Expand Up @@ -419,9 +419,6 @@ class TypedRangeSetAndFullsetImpl<std::string, CoalesceAdds>
*/
class RangeSetAndSuperset {
public:
/** Friend Subarray for calling `add_range_unrestricted` */
friend class Subarray;

/* ********************************* */
/* CONSTRUCTORS & DESTRUCTORS */
/* ********************************* */
Expand Down Expand Up @@ -487,6 +484,16 @@ class RangeSetAndSuperset {
tuple<Status, optional<std::string>> add_range(
Range& range, const bool read_range_oob_error = true);

/**
* Adds a range to the range manager without performing any checkes.
*
* If the ranges are currently implicitly initialized, then they will be
* cleared before the new range is added.
*
* @param range The range to add.
*/
Status add_range_unrestricted(const Range& range);

/**
* Removes all ranges.
*
Expand Down Expand Up @@ -568,20 +575,6 @@ class RangeSetAndSuperset {

/** Stored ranges. */
std::vector<Range> ranges_{};

/* ********************************* */
/* PRIVATE METHODS */
/* ********************************* */

/**
* Adds a range to the range manager without performing any checkes.
*
* If the ranges are currently implicitly initialized, then they will be
* cleared before the new range is added.
*
* @param range The range to add.
*/
Status add_range_unrestricted(const Range& range);
};

} // namespace tiledb::sm
Expand Down
22 changes: 11 additions & 11 deletions tiledb/sm/subarray/subarray.cc
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,17 @@ Status Subarray::add_range(
dim_idx, Range(&range[0], 2 * coord_size), err_on_range_oob_);
}

Status Subarray::add_range_unsafe(uint32_t dim_idx, const Range& range) {
// Must reset the result size and tile overlap
est_result_size_computed_ = false;
tile_overlap_.clear();

// Add the range
throw_if_not_ok(range_subset_[dim_idx].add_range_unrestricted(range));
is_default_[dim_idx] = range_subset_[dim_idx].is_implicitly_initialized();
return Status::Ok();
}

Status Subarray::add_point_ranges(
unsigned dim_idx, const void* start, uint64_t count, bool check_for_label) {
if (dim_idx >= this->array_->array_schema_latest().dim_num()) {
Expand Down Expand Up @@ -2112,17 +2123,6 @@ void Subarray::add_default_ranges() {
add_default_label_ranges(dim_num);
}

Status Subarray::add_range_unsafe(uint32_t dim_idx, const Range& range) {
// Must reset the result size and tile overlap
est_result_size_computed_ = false;
tile_overlap_.clear();

// Add the range
throw_if_not_ok(range_subset_[dim_idx].add_range_unrestricted(range));
is_default_[dim_idx] = range_subset_[dim_idx].is_implicitly_initialized();
return Status::Ok();
}

void Subarray::add_default_label_ranges(dimension_size_type dim_num) {
label_range_subset_.clear();
label_range_subset_.resize(dim_num, nullopt);
Expand Down
15 changes: 6 additions & 9 deletions tiledb/sm/subarray/subarray.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,6 @@ class ITileRange {
*/
class Subarray {
public:
/** Friend with Query to call `add_range_unsafe` */
friend class Query;

/* ********************************* */
/* PUBLIC DATA TYPES */
/* ********************************* */
Expand Down Expand Up @@ -478,6 +475,12 @@ class Subarray {
Status add_range(
unsigned dim_idx, const void* start, const void* end, const void* stride);

/**
* Adds a range along the dimension with the given index, without
* performing any error checks.
*/
Status add_range_unsafe(uint32_t dim_idx, const Range& range);

/**
* @brief Set point ranges from an array
*
Expand Down Expand Up @@ -1551,12 +1554,6 @@ class Subarray {
*/
void add_default_ranges();

/**
* Adds a range along the dimension with the given index, without
* performing any error checks.
*/
Status add_range_unsafe(uint32_t dim_idx, const Range& range);

/** Computes the estimated result size for all attributes/dimensions. */
Status compute_est_result_size(const Config* config, ThreadPool* compute_tp);

Expand Down

0 comments on commit c5fbf45

Please sign in to comment.