We want to store dense chunked data in the tiledb format using the C++ API and the TILEDB_GLOBAL_ORDER layout for writing. For doing so, fill values are added to the data such that it fits the specified tiling. Writing this data works, however getting the non-empty domain of the resulting array, seems to include the fill values whereas we would expect them to be excluded from the domain as they represent empty cells. An example of this behaviour is given below. Is this behaviour a bug, or do we just misunderstand the way in which the fill values or the non_empty domain work?
/*
Creates an 1-dimensional array of the form [nan, 1 | 2, 3] and read the non-empty domain of it.
Expected Output: [1, 3]
Received Output: [0, 3]
*/
// Create the array
std::vector<float> data {std::nanf(""), 1, 2, 3};
tiledb::Context Context {};
tiledb::Domain domain(Context);
domain.add_dimension(tiledb::Dimension::create<uint64_t>(Context, "test_dimension", {0, 3}, 2));
tiledb::ArraySchema schema(Context, TILEDB_DENSE);
schema.set_domain(domain);
schema.add_attribute(tiledb::Attribute::create<float>(Context, "test"));
std::filesystem::path path("test.tdb");
tiledb::Array::create(path, schema);
tiledb::Array array(Context, path, TILEDB_WRITE);
// Write data to the array
tiledb::Subarray subarray(Context, array);
subarray.add_range<uint64_t>(0, 0, 3);
tiledb::Query query(Context, array, TILEDB_WRITE);
query.set_layout(TILEDB_GLOBAL_ORDER);
query.set_subarray(subarray);
query.set_data_buffer("test", data);
query.submit();
query.finalize();
array.close();
// Get non-empty domain
array.open(TILEDB_READ);
std::cout << array.non_empty_domain<uint64_t>()[0].second.first << " "
<< array.non_empty_domain<uint64_t>()[0].second.second << std::endl;