Skip to content

Commit 40a9e1c

Browse files
committed
Clean code
1 parent d8b9eda commit 40a9e1c

File tree

3 files changed

+9
-46
lines changed

3 files changed

+9
-46
lines changed

tiledb/sm/serialization/query.cc

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -280,23 +280,17 @@ Subarray subarray_from_capnp(
280280
auto dim = array->array_schema_latest().dimension_ptr(i);
281281

282282
bool implicitly_initialized = range_reader.getHasDefaultRange();
283-
range_subset[i] =
284-
RangeSetAndSuperset(dim->type(), dim->domain(), true, coalesce_ranges);
283+
range_subset[i] = RangeSetAndSuperset(
284+
dim->type(), dim->domain(), implicitly_initialized, coalesce_ranges);
285285
is_default[i] = implicitly_initialized;
286286
if (range_reader.hasBufferSizes()) {
287287
auto ranges = range_buffers_from_capnp(range_reader);
288288
// If the range is implicitly initialized, the RangeSetAndSuperset
289289
// constructor will initialize the ranges to the domain.
290290
if (!implicitly_initialized) {
291-
// Edge case for dimension labels where there are only label ranges set.
292-
if (ranges.empty()) {
293-
range_subset[i] = RangeSetAndSuperset(
294-
dim->type(), dim->domain(), {dim->domain()}, coalesce_ranges);
295-
} else {
296-
// Add custom ranges, clearing any implicit ranges previously set.
297-
range_subset[i] = RangeSetAndSuperset(
298-
dim->type(), dim->domain(), ranges, coalesce_ranges);
299-
}
291+
// Add custom ranges, clearing any implicit ranges previously set.
292+
range_subset[i] = RangeSetAndSuperset(
293+
dim->type(), dim->domain(), ranges, coalesce_ranges);
300294
}
301295
} else {
302296
// Handle 1.7 style ranges where there is a single range with no sizes
@@ -325,7 +319,6 @@ Subarray subarray_from_capnp(
325319
// Set ranges for this dim label on the subarray
326320
label_range_subset[dim_index] = {
327321
label_name, dim->type(), label_ranges, coalesce_ranges};
328-
range_subset[dim_index].clear();
329322
is_default[dim_index] = false;
330323
}
331324
}
@@ -361,7 +354,7 @@ Subarray subarray_from_capnp(
361354

362355
auto frag_meta_size = array->opened_array()->fragment_metadata().size();
363356
return {
364-
array,
357+
array->opened_array(),
365358
layout,
366359
reader.hasStats() ? s.stats() : parent_stats,
367360
logger,

tiledb/sm/subarray/subarray.cc

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ Subarray::Subarray(
151151
}
152152

153153
Subarray::Subarray(
154-
const Array* array,
154+
const shared_ptr<OpenedArray> opened_array,
155155
Layout layout,
156156
stats::Stats* stats,
157157
shared_ptr<Logger> logger,
@@ -163,7 +163,7 @@ Subarray::Subarray(
163163
bool coalesce_ranges)
164164
: stats_(stats)
165165
, logger_(std::move(logger))
166-
, array_(array->opened_array())
166+
, array_(opened_array)
167167
, layout_(layout)
168168
, cell_order_(array_->array_schema_latest().cell_order())
169169
, range_subset_(std::move(range_subset))
@@ -1791,20 +1791,6 @@ Status Subarray::set_ranges_for_dim(
17911791
return Status::Ok();
17921792
}
17931793

1794-
void Subarray::set_label_ranges_for_dim(
1795-
const uint32_t dim_idx,
1796-
const std::string& name,
1797-
const std::vector<Range>& ranges) {
1798-
auto dim{array_->array_schema_latest().dimension_ptr(dim_idx)};
1799-
label_range_subset_[dim_idx] =
1800-
LabelRangeSubset(name, dim->type(), coalesce_ranges_);
1801-
for (const auto& range : ranges) {
1802-
throw_if_not_ok(
1803-
label_range_subset_[dim_idx].value().ranges_.add_range_unrestricted(
1804-
range));
1805-
}
1806-
}
1807-
18081794
Status Subarray::split(
18091795
unsigned splitting_dim,
18101796
const ByteVecValue& splitting_value,

tiledb/sm/subarray/subarray.h

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ class Subarray {
342342
* with existing ranges as they are added
343343
*/
344344
Subarray(
345-
const Array* array,
345+
const shared_ptr<OpenedArray> opened_array,
346346
Layout layout,
347347
stats::Stats* stats,
348348
shared_ptr<tiledb::common::Logger> logger,
@@ -1188,22 +1188,6 @@ class Subarray {
11881188
*/
11891189
Status set_ranges_for_dim(uint32_t dim_idx, const std::vector<Range>& ranges);
11901190

1191-
/**
1192-
* Directly sets the dimension label ranges for the given dimension index,
1193-
* making a deep copy.
1194-
*
1195-
* @param dim_idx Index of dimension to set
1196-
* @param name Name of the dimension label to set
1197-
* @param ranges `Range` vector that will be copied and set
1198-
* @return Status
1199-
*
1200-
* @note Intended for serialization only
1201-
*/
1202-
void set_label_ranges_for_dim(
1203-
const uint32_t dim_idx,
1204-
const std::string& name,
1205-
const std::vector<Range>& ranges);
1206-
12071191
/**
12081192
* Splits the subarray along the splitting dimension and value into
12091193
* two new subarrays `r1` and `r2`.

0 commit comments

Comments
 (0)