@@ -126,11 +126,10 @@ struct HandleConsolidationPlanRequestFx : RequestHandlerFx {
126
126
TEST_CASE_METHOD (
127
127
HandleLoadArraySchemaRequestFx,
128
128
" tiledb_handle_load_array_schema_request - no enumerations" ,
129
- " [request_handler][load_array_schema]" ) {
129
+ " [request_handler][load_array_schema][default] " ) {
130
130
auto stype = GENERATE (SerializationType::JSON, SerializationType::CAPNP);
131
131
132
132
create_array ();
133
- REQUIRE (cfg_.set (" rest.load_enumerations_on_array_open" , " false" ).ok ());
134
133
auto schema_response =
135
134
call_handler (serialization::LoadArraySchemaRequest (cfg_), stype);
136
135
auto schema = std::get<0 >(schema_response);
@@ -148,10 +147,11 @@ TEST_CASE_METHOD(
148
147
TEST_CASE_METHOD (
149
148
HandleLoadArraySchemaRequestFx,
150
149
" tiledb_handle_load_array_schema_request - load enumerations" ,
151
- " [request_handler][load_array_schema][with-enumerations][default] " ) {
150
+ " [request_handler][load_array_schema][with-enumerations]" ) {
152
151
auto stype = GENERATE (SerializationType::JSON, SerializationType::CAPNP);
153
152
154
153
create_array ();
154
+ REQUIRE (cfg_.set (" rest.load_enumerations_on_array_open" , " true" ).ok ());
155
155
auto schema_response =
156
156
call_handler (serialization::LoadArraySchemaRequest (cfg_), stype);
157
157
auto schema = std::get<0 >(schema_response);
@@ -173,6 +173,7 @@ TEST_CASE_METHOD(
173
173
" tiledb_handle_load_array_schema_request - multiple schemas" ,
174
174
" [request_handler][load_array_schema][schema-evolution]" ) {
175
175
auto stype = GENERATE (SerializationType::JSON, SerializationType::CAPNP);
176
+ std::string load_enums = GENERATE (" true" , " false" );
176
177
177
178
create_array ();
178
179
@@ -184,15 +185,20 @@ TEST_CASE_METHOD(
184
185
auto schema_response =
185
186
call_handler (serialization::LoadArraySchemaRequest (cfg_), stype);
186
187
auto schema = std::get<0 >(schema_response);
187
- REQUIRE (schema->has_enumeration (" enmr" ));
188
- REQUIRE (schema->get_loaded_enumeration_names ().size () == 1 );
189
- REQUIRE (schema->get_loaded_enumeration_names ()[0 ] == " enmr" );
190
- REQUIRE (schema->get_enumeration (" enmr" ) != nullptr );
188
+ if (load_enums == " true" ) {
189
+ REQUIRE (schema->has_enumeration (" enmr" ));
190
+ REQUIRE (schema->get_loaded_enumeration_names ().size () == 1 );
191
+ REQUIRE (schema->get_loaded_enumeration_names ()[0 ] == " enmr" );
192
+ REQUIRE (schema->get_enumeration (" enmr" ) != nullptr );
193
+ }
191
194
// The latest schema should be equal to the last applied evolution.
192
195
tiledb::test::schema_equiv (*schema, *all_schemas.back ());
193
196
194
- // Validate all array schemas returned from the request.
195
- for (int i = 0 ; const auto & s : std::get<1 >(schema_response)) {
197
+ // Validate schemas returned from the request in the order they were created.
198
+ auto r_all_schemas = std::get<1 >(schema_response);
199
+ std::map<std::string, shared_ptr<ArraySchema>> resp (
200
+ r_all_schemas.begin (), r_all_schemas.end ());
201
+ for (int i = 0 ; const auto & s : resp) {
196
202
tiledb::test::schema_equiv (*s.second , *all_schemas[i++]);
197
203
}
198
204
}
@@ -468,18 +474,17 @@ shared_ptr<ArraySchema> HandleLoadArraySchemaRequestFx::schema_add_attribute(
468
474
tiledb::ArraySchemaEvolution ase (ctx);
469
475
auto attr = tiledb::Attribute::create<int32_t >(ctx, attr_name);
470
476
ase.add_attribute (attr);
471
- auto evolved = ase.ptr ()->array_schema_evolution_ ->evolve_schema (schema_);
477
+ // Evolve and update the original schema member variable.
478
+ schema_ = ase.ptr ()->array_schema_evolution_ ->evolve_schema (schema_);
472
479
// Apply the schema evolution.
473
480
Array::evolve_array_schema (
474
481
this ->ctx_ .resources (),
475
482
this ->uri_ ,
476
483
ase.ptr ()->array_schema_evolution_ ,
477
484
this ->enc_key_ );
478
485
479
- // Update the original schema.
480
- schema_ = evolved;
481
- // Return the schema for validation.
482
- return evolved;
486
+ // Return the new evolved schema for validation.
487
+ return schema_;
483
488
}
484
489
485
490
shared_ptr<ArraySchema> HandleLoadArraySchemaRequestFx::create_schema () {
0 commit comments