@@ -804,19 +804,21 @@ void Array::encryption_type(
804804
805805shared_ptr<const Enumeration> Array::get_enumeration (
806806 const std::string& enumeration_name) {
807- return get_enumerations ({enumeration_name})[0 ];
807+ return get_enumerations (
808+ {enumeration_name}, opened_array_->array_schema_latest_ptr ())[0 ];
808809}
809810
810811std::vector<shared_ptr<const Enumeration>> Array::get_enumerations (
811- const std::vector<std::string>& enumeration_names) {
812+ const std::vector<std::string>& enumeration_names,
813+ shared_ptr<ArraySchema> schema) {
812814 if (!is_open_) {
813815 throw ArrayException (" Unable to load enumerations; Array is not open." );
814816 }
815817
816818 // Dedupe requested names and filter out anything already loaded.
817819 std::unordered_set<std::string> enmrs_to_load;
818820 for (auto & enmr_name : enumeration_names) {
819- if (array_schema_latest (). is_enumeration_loaded (enmr_name)) {
821+ if (schema-> is_enumeration_loaded (enmr_name)) {
820822 continue ;
821823 }
822824 enmrs_to_load.insert (enmr_name);
@@ -850,7 +852,7 @@ std::vector<shared_ptr<const Enumeration>> Array::get_enumerations(
850852 // Create a vector of paths to be loaded.
851853 std::vector<std::string> paths_to_load;
852854 for (auto & enmr_name : enmrs_to_load) {
853- auto path = array_schema_latest (). get_enumeration_path_name (enmr_name);
855+ auto path = schema-> get_enumeration_path_name (enmr_name);
854856 paths_to_load.push_back (path);
855857 }
856858
@@ -861,14 +863,14 @@ std::vector<shared_ptr<const Enumeration>> Array::get_enumerations(
861863
862864 // Store the loaded enumerations in the schema
863865 for (auto & enmr : loaded) {
864- opened_array_-> array_schema_latest_ptr () ->store_enumeration (enmr);
866+ schema ->store_enumeration (enmr);
865867 }
866868 }
867869
868870 // Return the requested list of enumerations
869871 std::vector<shared_ptr<const Enumeration>> ret (enumeration_names.size ());
870872 for (size_t i = 0 ; i < enumeration_names.size (); i++) {
871- ret[i] = array_schema_latest (). get_enumeration (enumeration_names[i]);
873+ ret[i] = schema-> get_enumeration (enumeration_names[i]);
872874 }
873875 return ret;
874876}
@@ -878,7 +880,9 @@ void Array::load_all_enumerations() {
878880 throw ArrayException (" Unable to load all enumerations; Array is not open." );
879881 }
880882 // Load all enumerations, discarding the returned list of loaded enumerations.
881- get_enumerations (array_schema_latest ().get_enumeration_names ());
883+ for (const auto & schema : array_schemas_all ()) {
884+ get_enumerations (schema.second ->get_enumeration_names (), schema.second );
885+ }
882886}
883887
884888bool Array::is_empty () const {
0 commit comments