@@ -151,16 +151,16 @@ void Consolidator::array_consolidate(
151151 throw ConsolidatorException (" Cannot consolidate array; Invalid URI" );
152152 }
153153
154- // Check if array exists
155- if (object_type (resources, array_uri) != ObjectType::ARRAY) {
156- throw ConsolidatorException (
157- " Cannot consolidate array; Array does not exist" );
158- }
159-
160154 if (array_uri.is_tiledb ()) {
161155 throw_if_not_ok (
162156 resources.rest_client ()->post_consolidation_to_rest (array_uri, config));
163157 } else {
158+ // Check if array exists
159+ if (object_type (resources, array_uri) != ObjectType::ARRAY) {
160+ throw ConsolidatorException (
161+ " Cannot consolidate array; Array does not exist" );
162+ }
163+
164164 // Get encryption key from config
165165 std::string encryption_key_from_cfg;
166166 if (!encryption_key) {
@@ -212,46 +212,54 @@ void Consolidator::fragments_consolidate(
212212 throw ConsolidatorException (" Cannot consolidate array; Invalid URI" );
213213 }
214214
215- // Check if array exists
216- if (object_type (resources, array_uri) != ObjectType::ARRAY) {
217- throw ConsolidatorException (
218- " Cannot consolidate array; Array does not exist" );
219- }
215+ if (array_uri.is_tiledb ()) {
216+ throw_if_not_ok (
217+ storage_manager->resources ().rest_client ()->post_consolidation_to_rest (
218+ array_uri, config, &fragment_uris));
219+ } else {
220+ // Check if array exists
221+ if (object_type (resources, array_uri) != ObjectType::ARRAY) {
222+ throw ConsolidatorException (
223+ " Cannot consolidate array; Array does not exist" );
224+ }
220225
221- // Get encryption key from config
222- std::string encryption_key_from_cfg;
223- if (!encryption_key) {
224- bool found = false ;
225- encryption_key_from_cfg = config.get (" sm.encryption_key" , &found);
226- assert (found);
227- }
226+ // Get encryption key from config
227+ std::string encryption_key_from_cfg;
228+ if (!encryption_key) {
229+ bool found = false ;
230+ encryption_key_from_cfg = config.get (" sm.encryption_key" , &found);
231+ assert (found);
232+ }
228233
229- if (!encryption_key_from_cfg.empty ()) {
230- encryption_key = encryption_key_from_cfg.c_str ();
231- key_length = static_cast <uint32_t >(encryption_key_from_cfg.size ());
232- std::string encryption_type_from_cfg;
233- bool found = false ;
234- encryption_type_from_cfg = config.get (" sm.encryption_type" , &found);
235- assert (found);
236- auto [st, et] = encryption_type_enum (encryption_type_from_cfg);
237- throw_if_not_ok (st);
238- encryption_type = et.value ();
239-
240- if (!EncryptionKey::is_valid_key_length (
241- encryption_type,
242- static_cast <uint32_t >(encryption_key_from_cfg.size ()))) {
243- encryption_key = nullptr ;
244- key_length = 0 ;
234+ if (!encryption_key_from_cfg.empty ()) {
235+ encryption_key = encryption_key_from_cfg.c_str ();
236+ key_length = static_cast <uint32_t >(encryption_key_from_cfg.size ());
237+ std::string encryption_type_from_cfg;
238+ bool found = false ;
239+ encryption_type_from_cfg = config.get (" sm.encryption_type" , &found);
240+ assert (found);
241+ auto [st, et] = encryption_type_enum (encryption_type_from_cfg);
242+ throw_if_not_ok (st);
243+ encryption_type = et.value ();
244+
245+ if (!EncryptionKey::is_valid_key_length (
246+ encryption_type,
247+ static_cast <uint32_t >(encryption_key_from_cfg.size ()))) {
248+ encryption_key = nullptr ;
249+ key_length = 0 ;
250+ }
245251 }
246- }
247252
248- // Consolidate
249- auto consolidator = Consolidator::create (
250- resources, ConsolidationMode::FRAGMENT, config, storage_manager);
251- auto fragment_consolidator =
252- dynamic_cast <FragmentConsolidator*>(consolidator.get ());
253- throw_if_not_ok (fragment_consolidator->consolidate_fragments (
254- array_name, encryption_type, encryption_key, key_length, fragment_uris));
253+ // Consolidate
254+ auto fragment_consolidator =
255+ make_shared<FragmentConsolidator>(HERE (), config, storage_manager);
256+ throw_if_not_ok (fragment_consolidator->consolidate_fragments (
257+ array_name,
258+ encryption_type,
259+ encryption_key,
260+ key_length,
261+ fragment_uris));
262+ }
255263}
256264
257265void Consolidator::write_consolidated_commits_file (
0 commit comments