Skip to content

Commit

Permalink
User can set separate coordinate buffers upon reads. Towards addressing
Browse files Browse the repository at this point in the history
  • Loading branch information
stavrospapadopoulos committed Mar 18, 2020
1 parent 2c492ea commit 9e31d29
Show file tree
Hide file tree
Showing 34 changed files with 1,676 additions and 1,168 deletions.
3 changes: 3 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@

* Changed `domain` input of `tiledb_dimension_get_domain` to `const void**` (from `void**`).
* Changed `tile_extent` input of `tiledb_dimension_get_tile_extent` to `const void**` (from `void**`).
* Anonymous attribute and dimensions (i.e., empty strings for attribute/dimension names) is no longer supported. This is because now the user can set separate dimension buffers to the query and, therefore, supporting anonymous attributes and dimensions creates ambiguity in the current API.

## New features

* The user can now set separate coordinate buffers to the query. Also any subset of the dimensions is supported.

## Improvements

* Added support for AWS Security Token Service session tokens via configuration option `vfs.s3.session_token`. [#1472](https://github.com/TileDB-Inc/TileDB/pull/1472)
Expand Down
10 changes: 10 additions & 0 deletions test/src/unit-SubarrayPartitioner-error.cc
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ TEST_CASE_METHOD(
CHECK(!st.ok());
st = subarray_partitioner.set_result_budget("b", 100, 101);
CHECK(st.ok());
st = subarray_partitioner.set_result_budget("d", 1000, 1010);
CHECK(!st.ok());
st = subarray_partitioner.set_result_budget("d", 1000);
CHECK(st.ok());
st =
subarray_partitioner.get_result_budget(nullptr, &budget_off, &budget_val);
CHECK(!st.ok());
Expand All @@ -196,15 +200,21 @@ TEST_CASE_METHOD(
st = subarray_partitioner.get_result_budget(
TILEDB_COORDS, &budget_off, &budget_val);
CHECK(!st.ok());
st = subarray_partitioner.get_result_budget("d", &budget);
CHECK(st.ok());
CHECK(budget == 1000);

uint64_t memory_budget, memory_budget_var;
st = subarray_partitioner.get_memory_budget(
&memory_budget, &memory_budget_var);
CHECK(st.ok());
CHECK(memory_budget == memory_budget_);
CHECK(memory_budget_var == memory_budget_var_);
st = subarray_partitioner.set_memory_budget(16, 16);
CHECK(st.ok());
st = subarray_partitioner.get_memory_budget(
&memory_budget, &memory_budget_var);
CHECK(st.ok());
CHECK(memory_budget == 16);
CHECK(memory_budget_var == 16);

Expand Down
187 changes: 0 additions & 187 deletions test/src/unit-capi-array_schema.cc
Original file line number Diff line number Diff line change
Expand Up @@ -957,193 +957,6 @@ TEST_CASE_METHOD(
tiledb_domain_free(&domain);
}

TEST_CASE_METHOD(
ArraySchemaFx,
"C API: Test array schema multiple anonymous dimensions",
"[capi], [array-schema]") {
// Create dimensions
tiledb_dimension_t* d1;
int rc = tiledb_dimension_alloc(
ctx_, "", TILEDB_INT64, &DIM_DOMAIN[0], &TILE_EXTENTS[0], &d1);
REQUIRE(rc == TILEDB_OK);

tiledb_dimension_t* d2;
rc = tiledb_dimension_alloc(
ctx_, "", TILEDB_INT64, &DIM_DOMAIN[2], &TILE_EXTENTS[1], &d2);
REQUIRE(rc == TILEDB_OK);

// Set domain
tiledb_domain_t* domain;
rc = tiledb_domain_alloc(ctx_, &domain);
REQUIRE(rc == TILEDB_OK);
rc = tiledb_domain_add_dimension(ctx_, domain, d1);
REQUIRE(rc == TILEDB_OK);
rc = tiledb_domain_add_dimension(ctx_, domain, d2);
REQUIRE(rc == TILEDB_OK);

tiledb_dimension_t* get_dim = nullptr;
rc = tiledb_domain_get_dimension_from_name(ctx_, domain, "", &get_dim);
// getting multiple anonymous dimension by name is an error
CHECK(rc == TILEDB_ERR);

rc = tiledb_domain_get_dimension_from_index(ctx_, domain, 0, &get_dim);
CHECK(rc == TILEDB_OK);
CHECK(get_dim != nullptr);
tiledb_dimension_free(&get_dim);

// Clean up
tiledb_dimension_free(&d1);
tiledb_dimension_free(&d2);
tiledb_domain_free(&domain);
}

TEST_CASE_METHOD(
ArraySchemaFx,
"C API: Test array schema one anonymous attribute",
"[capi], [array-schema], [anon-attr]") {
// Create array schema
tiledb_array_schema_t* array_schema;
int rc = tiledb_array_schema_alloc(ctx_, TILEDB_DENSE, &array_schema);
REQUIRE(rc == TILEDB_OK);

// Create dimensions
tiledb_dimension_t* d1;
rc = tiledb_dimension_alloc(
ctx_, "", TILEDB_INT64, &DIM_DOMAIN[0], &TILE_EXTENTS[0], &d1);
REQUIRE(rc == TILEDB_OK);

// Set domain
tiledb_domain_t* domain;
rc = tiledb_domain_alloc(ctx_, &domain);
REQUIRE(rc == TILEDB_OK);
rc = tiledb_domain_add_dimension(ctx_, domain, d1);
REQUIRE(rc == TILEDB_OK);
rc = tiledb_array_schema_set_domain(ctx_, array_schema, domain);
REQUIRE(rc == TILEDB_OK);

// Set attribute
tiledb_attribute_t* attr1;
rc = tiledb_attribute_alloc(ctx_, "", ATTR_TYPE, &attr1);
REQUIRE(rc == TILEDB_OK);
tiledb_attribute_t* attr2;
rc = tiledb_attribute_alloc(ctx_, "foo", ATTR_TYPE, &attr2);
REQUIRE(rc == TILEDB_OK);

rc = tiledb_array_schema_add_attribute(ctx_, array_schema, attr1);
REQUIRE(rc == TILEDB_OK);
rc = tiledb_array_schema_add_attribute(ctx_, array_schema, attr2);
REQUIRE(rc == TILEDB_OK);

tiledb_attribute_t* get_attr = nullptr;
rc = tiledb_array_schema_get_attribute_from_name(
ctx_, array_schema, "", &get_attr);
// from name when there are multiple anon attributes is an error
CHECK(rc == TILEDB_OK);
CHECK(get_attr != nullptr);
tiledb_attribute_free(&get_attr);

rc = tiledb_array_schema_get_attribute_from_index(
ctx_, array_schema, 0, &get_attr);
CHECK(rc == TILEDB_OK);
CHECK(get_attr != nullptr);
const char* get_name = nullptr;
rc = tiledb_attribute_get_name(ctx_, get_attr, &get_name);
CHECK(rc == TILEDB_OK);
CHECK(get_name != nullptr);
CHECK_THAT(get_name, Catch::Equals(""));
tiledb_attribute_free(&get_attr);

rc = tiledb_array_schema_get_attribute_from_name(
ctx_, array_schema, "foo", &get_attr);
CHECK(rc == TILEDB_OK);
CHECK(get_attr != nullptr);
rc = tiledb_attribute_get_name(ctx_, get_attr, &get_name);
CHECK(rc == TILEDB_OK);
CHECK_THAT(get_name, Catch::Equals("foo"));
tiledb_attribute_free(&get_attr);

int32_t has_attr = 0;
rc = tiledb_array_schema_has_attribute(ctx_, array_schema, "", &has_attr);
REQUIRE(rc == TILEDB_OK);
REQUIRE(has_attr == 1);
has_attr = 0;
rc = tiledb_array_schema_has_attribute(ctx_, array_schema, "foo", &has_attr);
REQUIRE(rc == TILEDB_OK);
REQUIRE(has_attr == 1);
has_attr = 0;
rc = tiledb_array_schema_has_attribute(ctx_, array_schema, "bar", &has_attr);
REQUIRE(rc == TILEDB_OK);
REQUIRE(has_attr == 0);

// Clean up
tiledb_attribute_free(&attr1);
tiledb_attribute_free(&attr2);
tiledb_dimension_free(&d1);
tiledb_domain_free(&domain);
tiledb_array_schema_free(&array_schema);
}

TEST_CASE_METHOD(
ArraySchemaFx,
"C API: Test array schema multiple anonymous attributes",
"[capi], [array-schema], [anon-attr]") {
// Create array schema
tiledb_array_schema_t* array_schema;
int rc = tiledb_array_schema_alloc(ctx_, TILEDB_DENSE, &array_schema);
REQUIRE(rc == TILEDB_OK);

// Create dimensions
tiledb_dimension_t* d1;
rc = tiledb_dimension_alloc(
ctx_, "", TILEDB_INT64, &DIM_DOMAIN[0], &TILE_EXTENTS[0], &d1);
REQUIRE(rc == TILEDB_OK);

// Set domain
tiledb_domain_t* domain;
rc = tiledb_domain_alloc(ctx_, &domain);
REQUIRE(rc == TILEDB_OK);
rc = tiledb_domain_add_dimension(ctx_, domain, d1);
REQUIRE(rc == TILEDB_OK);
rc = tiledb_array_schema_set_domain(ctx_, array_schema, domain);
REQUIRE(rc == TILEDB_OK);

// Set attribute
tiledb_attribute_t* attr1;
rc = tiledb_attribute_alloc(ctx_, "", ATTR_TYPE, &attr1);
REQUIRE(rc == TILEDB_OK);
tiledb_attribute_t* attr2;
rc = tiledb_attribute_alloc(ctx_, "", ATTR_TYPE, &attr2);
REQUIRE(rc == TILEDB_OK);

rc = tiledb_array_schema_add_attribute(ctx_, array_schema, attr1);
REQUIRE(rc == TILEDB_OK);
rc = tiledb_array_schema_add_attribute(ctx_, array_schema, attr2);
CHECK(rc != TILEDB_OK);

tiledb_attribute_t* get_attr = nullptr;
rc = tiledb_array_schema_get_attribute_from_name(
ctx_, array_schema, "", &get_attr);
CHECK(rc == TILEDB_OK);

rc = tiledb_array_schema_get_attribute_from_index(
ctx_, array_schema, 0, &get_attr);
CHECK(rc == TILEDB_OK);
CHECK(get_attr != nullptr);
tiledb_attribute_free(&get_attr);

int32_t has_attr = false;
rc = tiledb_array_schema_has_attribute(ctx_, array_schema, "", &has_attr);
REQUIRE(rc == TILEDB_OK);
REQUIRE(has_attr == 1);

// Clean up
tiledb_attribute_free(&attr1);
tiledb_attribute_free(&attr2);
tiledb_dimension_free(&d1);
tiledb_domain_free(&domain);
tiledb_array_schema_free(&array_schema);
}

TEST_CASE_METHOD(
ArraySchemaFx,
"C API: Test array schema with invalid float dense domain",
Expand Down
2 changes: 1 addition & 1 deletion test/src/unit-capi-consolidation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2714,7 +2714,7 @@ bool ConsolidationFx::is_array(const std::string& array_name) {
TEST_CASE_METHOD(
ConsolidationFx,
"C API: Test consolidation, dense",
"[capi][consolidation][dense-consolidation]") {
"[capi][consolidation][dense]") {
remove_dense_array();
create_dense_array();

Expand Down
Loading

0 comments on commit 9e31d29

Please sign in to comment.