Skip to content

Commit

Permalink
Fix failing test by sorting attrs and dims in QueryPlan constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
ypatia committed Nov 14, 2023
1 parent 92a430e commit 1fef9c6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 9 additions & 4 deletions test/src/unit-request-handlers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,19 @@ TEST_CASE_METHOD(
int32_t dom[] = {1, 2, 1, 2};
REQUIRE(tiledb_query_set_subarray(ctx, query, &dom) == TILEDB_OK);

std::vector<int32_t> a1(2);
uint64_t size = 1;
std::vector<int32_t> a1(2);
REQUIRE(
tiledb_query_set_data_buffer(ctx, query, "attr1", a1.data(), &size) ==
TILEDB_OK);
std::vector<int64_t> a2(2);
std::vector<int32_t> a2(2);
REQUIRE(
tiledb_query_set_data_buffer(ctx, query, "attr2", a2.data(), &size) ==
TILEDB_OK);
std::vector<int64_t> a3(2);
REQUIRE(
tiledb_query_set_data_buffer(ctx, query, "attr3", a3.data(), &size) ==
TILEDB_OK);

// Use C API to get the query plan
tiledb_string_handle_t* query_plan;
Expand Down Expand Up @@ -337,7 +341,6 @@ shared_ptr<ArraySchema> HandleQueryPlanRequestFx::create_schema() {
throw_if_not_ok(schema->set_cell_order(Layout::ROW_MAJOR));
throw_if_not_ok(schema->set_tile_order(Layout::ROW_MAJOR));
uint32_t dim_domain[] = {1, 10, 1, 10};
// uint64_t extents[] = {5, 5};

auto dim1 = make_shared<Dimension>(HERE(), "dim1", Datatype::INT32);
throw_if_not_ok(dim1->set_domain(&dim_domain[0]));
Expand All @@ -351,8 +354,10 @@ shared_ptr<ArraySchema> HandleQueryPlanRequestFx::create_schema() {

auto attr1 = make_shared<Attribute>(HERE(), "attr1", Datatype::INT32);
throw_if_not_ok(schema->add_attribute(attr1));
auto attr2 = make_shared<Attribute>(HERE(), "attr2", Datatype::INT64);
auto attr2 = make_shared<Attribute>(HERE(), "attr2", Datatype::INT32);
throw_if_not_ok(schema->add_attribute(attr2));
auto attr3 = make_shared<Attribute>(HERE(), "attr3", Datatype::INT64);
throw_if_not_ok(schema->add_attribute(attr3));

return schema;
}
Expand Down
2 changes: 2 additions & 0 deletions tiledb/sm/query_plan/query_plan.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ QueryPlan::QueryPlan(Query& query) {
if (query.is_dense()) {
dimensions_ = query.array()->array_schema_latest().dim_names();
}
std::sort(attributes_.begin(), attributes_.end());
std::sort(dimensions_.begin(), dimensions_.end());
}

/* ********************************* */
Expand Down

0 comments on commit 1fef9c6

Please sign in to comment.