MCPcopy Create free account
hub / github.com/TileDB-Inc/TileDB / compute_range_uint64

Method compute_range_uint64

tiledb/sm/subarray/subarray_partitioner.cc:1345–1401  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1343}
1344
1345void SubarrayPartitioner::compute_range_uint64(
1346 const Subarray& range,
1347 std::vector<std::array<uint64_t, 2>>* range_uint64,
1348 bool* unsplittable) const {
1349 // Initializations
1350 const auto& array_schema = subarray_.array()->array_schema_latest();
1351 auto dim_num = array_schema.dim_num();
1352 const Range* r;
1353 *unsplittable = true;
1354 range_uint64->resize(dim_num);
1355 Hilbert h(dim_num);
1356 auto bits = h.bits();
1357 auto max_bucket_val = ((uint64_t)1 << bits) - 1;
1358
1359 // Default values for empty range start/end
1360 auto max_string = std::string("\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F", 8);
1361
1362 // Calculate mapped range
1363 bool empty_start, empty_end;
1364 for (uint32_t d = 0; d < dim_num; ++d) {
1365 auto dim{array_schema.dimension_ptr(d)};
1366 auto var = dim->var_size();
1367 range.get_range(d, 0, &r);
1368 empty_start = var ? (r->start_size() == 0) : r->empty();
1369 empty_end = var ? (r->end_size() == 0) : r->empty();
1370 auto max_default =
1371 var ? dim->map_to_uint64(
1372 max_string.data(), max_string.size(), bits, max_bucket_val) :
1373 (UINT64_MAX >> (64 - bits));
1374 if (r->var_size()) {
1375 auto start_str = r->start_str();
1376 (*range_uint64)[d][0] =
1377 empty_start ? 0 : // min default
1378 dim->map_to_uint64(
1379 start_str.data(), start_str.size(), bits, max_bucket_val);
1380 auto end_str = r->end_str();
1381 (*range_uint64)[d][1] =
1382 empty_end ? max_default :
1383 dim->map_to_uint64(
1384 end_str.data(), end_str.size(), bits, max_bucket_val);
1385 } else {
1386 // Note: coord_size is ignored for fixed size in map_to_uint64.
1387 (*range_uint64)[d][0] =
1388 empty_start ? 0 : // min default
1389 dim->map_to_uint64(r->start_fixed(), 0, bits, max_bucket_val);
1390 (*range_uint64)[d][1] =
1391 empty_end ?
1392 max_default :
1393 dim->map_to_uint64(r->end_fixed(), 0, bits, max_bucket_val);
1394 }
1395
1396 iassert((*range_uint64)[d][0] <= (*range_uint64)[d][1]);
1397
1398 if ((*range_uint64)[d][0] != (*range_uint64)[d][1])
1399 *unsplittable = false;
1400 }
1401}
1402

Callers

nothing calls this directly

Calls 15

array_schema_latestMethod · 0.80
bitsMethod · 0.80
start_sizeMethod · 0.80
end_sizeMethod · 0.80
start_strMethod · 0.80
end_strMethod · 0.80
start_fixedMethod · 0.80
end_fixedMethod · 0.80
arrayMethod · 0.45
dim_numMethod · 0.45
resizeMethod · 0.45
dimension_ptrMethod · 0.45

Tested by

no test coverage detected