Skip to content

Commit d8cb209

Browse files
committed
Plumb latest schema name through deserialization.
1 parent cbd15a9 commit d8cb209

File tree

4 files changed

+20
-15
lines changed

4 files changed

+20
-15
lines changed

tiledb/sm/array/array.cc

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -919,16 +919,13 @@ std::vector<shared_ptr<const Enumeration>> Array::get_enumerations(
919919
names_to_load.push_back(enmr_name);
920920
}
921921

922-
loaded = rest_client
923-
->post_enumerations_from_rest(
924-
array_uri_,
925-
array_dir_timestamp_start_,
926-
array_dir_timestamp_end_,
927-
this,
928-
names_to_load,
929-
memory_tracker_)
930-
.begin()
931-
->second;
922+
loaded = rest_client->post_enumerations_from_rest(
923+
array_uri_,
924+
array_dir_timestamp_start_,
925+
array_dir_timestamp_end_,
926+
this,
927+
names_to_load,
928+
memory_tracker_)[array_schema_latest().name()];
932929
} else {
933930
// Create a vector of paths to be loaded.
934931
std::vector<std::string> paths_to_load;

tiledb/sm/rest/rest_client_remote.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ RestClientRemote::post_enumerations_from_rest(
658658
// Ensure data has a null delimiter for cap'n proto if using JSON
659659
throw_if_not_ok(ensure_json_null_delimited_string(&returned_data));
660660
return serialization::deserialize_load_enumerations_response(
661-
serialization_type_, returned_data, memory_tracker);
661+
*array, serialization_type_, returned_data, memory_tracker);
662662
}
663663

664664
void RestClientRemote::post_query_plan_from_rest(

tiledb/sm/serialization/enumeration.cc

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ void load_enumerations_response_to_capnp(
190190
std::unordered_map<std::string, std::vector<shared_ptr<const Enumeration>>>
191191
load_enumerations_response_from_capnp(
192192
const capnp::LoadEnumerationsResponse::Reader& reader,
193+
const Array& array,
193194
shared_ptr<MemoryTracker> memory_tracker) {
194195
std::unordered_map<std::string, std::vector<shared_ptr<const Enumeration>>>
195196
ret;
@@ -202,7 +203,7 @@ load_enumerations_response_from_capnp(
202203
}
203204
// The name of the array schema will not be used if we only loaded
204205
// enumerations on the latest array schema.
205-
return {{"", loaded_enmrs}};
206+
return {{array.array_schema_latest().name(), loaded_enmrs}};
206207
} else if (reader.hasAllEnumerations()) {
207208
auto all_enmrs_reader = reader.getAllEnumerations();
208209
for (auto enmr_entry_reader : all_enmrs_reader.getEntries()) {
@@ -343,6 +344,7 @@ void serialize_load_enumerations_response(
343344

344345
std::unordered_map<std::string, std::vector<shared_ptr<const Enumeration>>>
345346
deserialize_load_enumerations_response(
347+
const Array& array,
346348
SerializationType serialize_type,
347349
span<const char> response,
348350
shared_ptr<MemoryTracker> memory_tracker) {
@@ -355,7 +357,8 @@ deserialize_load_enumerations_response(
355357
message_builder.initRoot<capnp::LoadEnumerationsResponse>();
356358
json.decode(kj::StringPtr(response.data(), response.size()), builder);
357359
capnp::LoadEnumerationsResponse::Reader reader = builder.asReader();
358-
return load_enumerations_response_from_capnp(reader, memory_tracker);
360+
return load_enumerations_response_from_capnp(
361+
reader, array, memory_tracker);
359362
}
360363
case SerializationType::CAPNP: {
361364
const auto mBytes = reinterpret_cast<const kj::byte*>(response.data());
@@ -364,7 +367,8 @@ deserialize_load_enumerations_response(
364367
response.size() / sizeof(::capnp::word)));
365368
capnp::LoadEnumerationsResponse::Reader reader =
366369
array_reader.getRoot<capnp::LoadEnumerationsResponse>();
367-
return load_enumerations_response_from_capnp(reader, memory_tracker);
370+
return load_enumerations_response_from_capnp(
371+
reader, array, memory_tracker);
368372
}
369373
default: {
370374
throw EnumerationSerializationException(
@@ -408,7 +412,10 @@ void serialize_load_enumerations_response(
408412

409413
std::unordered_map<std::string, std::vector<shared_ptr<const Enumeration>>>
410414
deserialize_load_enumerations_response(
411-
SerializationType, span<const char>, shared_ptr<MemoryTracker>) {
415+
const Array&,
416+
SerializationType,
417+
span<const char>,
418+
shared_ptr<MemoryTracker>) {
412419
throw EnumerationSerializationDisabledException();
413420
}
414421

tiledb/sm/serialization/enumeration.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ void serialize_load_enumerations_response(
9292

9393
std::unordered_map<std::string, std::vector<shared_ptr<const Enumeration>>>
9494
deserialize_load_enumerations_response(
95+
const Array& array,
9596
SerializationType serialization_type,
9697
span<const char> response,
9798
shared_ptr<MemoryTracker> memory_tracker);

0 commit comments

Comments
 (0)