Multi-Range Subarrays

You can slice a multi-range subarray as follows (also see Subarray):

C
C++
Python
R
Java
Go
C
// ... create context ctx
// ... create query
// Add two ranges to first dimension
// Set multi-range subarray to query
int row_0_start = 1, row_0_end = 2;
int row_1_start = 4, row_1_end = 4;
tiledb_query_add_range(ctx, query, 0, &row_0_start, &row_0_end, NULL);
tiledb_query_add_range(ctx, query, 0, &row_1_start, &row_1_end, NULL);
// Add one range to the second dimension
int col_0_start = 1, col_0_end = 4;
tiledb_query_add_range(ctx, query, 1, &col_0_start, &col_0_end, NULL);
C++
// ... create query
// Add two ranges to first dimension
int row_0_start = 1, row_0_end = 2;
int row_1_start = 4, row_1_end = 4;
query.add_range(0, row_0_start, row_0_end)
.add_range(0, row_1_start, row_1_end);
// Add one range to the second dimension
int col_0_start = 1, col_0_end = 4;
query.add_range(1, col_0_start, col_0_end);
Python
# ... open array
# slice subarrays [1,2]x[1,4] and [4,4]x[1,4]
A.multi_index[ [slice(1,2), 4], 1:4 ]
# NOTE: Ranges in multi_index are all inclusive
# multi-range slicing of a dense array returns a NumPy array
# matching the shape of the selection.
# multi-range slicing of a sparse array returns a coordinate
# array and value array(s) for each attribute, similar to
# other sparse queries
R
# TODO: Multi-range subarrays are currently not supported in R
Java
// ... create query
// Add two ranges to first dimension
int row_0_start = 1, row_0_end = 2;
int row_1_start = 4, row_1_end = 4;
query.addRange(0, row_0_start, row_0_end)
.addRange(0, row_1_start, row_1_end);
// Add one range to the second dimension
int col_0_start = 1, col_0_end = 4;
query.addRange(1, col_0_start, col_0_end);
Go
// ... create query
// Add two ranges to first dimension
query.AddRange(0, int32(1), int32(2))
query.AddRange(0, int32(4), int32(4))
// Add one range to the second dimension
query.AddRange(1, int32(1), int32(4))

Slicing with a stride is not currently supported, but it is work in progress. See our roadmap for updates.