diff --git a/dev/archery/archery/integration/tester_java.py b/dev/archery/archery/integration/tester_java.py index cb994d273c81b..ba4c859ccec49 100644 --- a/dev/archery/archery/integration/tester_java.py +++ b/dev/archery/archery/integration/tester_java.py @@ -188,22 +188,22 @@ def import_batch_and_compare_to_json(self, json_path, num_batch, if num_batch > 0: actually_skipped = json_reader.skip(num_batch) assert actually_skipped == num_batch - with (json_reader.read() as batch, - self.java_arrow.vector.VectorSchemaRoot.create( - schema, self.java_allocator) as imported_batch): - # We need to pass a dict provider primed with dictionary ids - # matching those in the schema, hence an empty - # CDataDictionaryProvider would not work here! - dict_provider = (self.java_arrow.vector.dictionary - .DictionaryProvider.MapDictionaryProvider()) - dict_provider.copyStructureFrom(json_reader, self.java_allocator) - with dict_provider: - self.java_arrow.c.Data.importIntoVectorSchemaRoot( - self.java_allocator, - self._wrap_c_array_ptr(c_array_ptr), - imported_batch, dict_provider) - self._assert_batches_equal(batch, imported_batch) - self._assert_dict_providers_equal(json_reader, dict_provider) + with json_reader.read() as batch: + with self.java_arrow.vector.VectorSchemaRoot.create( + schema, self.java_allocator) as imported_batch: + # We need to pass a dict provider primed with dictionary ids + # matching those in the schema, hence an empty + # CDataDictionaryProvider would not work here. + dict_provider = (self.java_arrow.vector.dictionary + .DictionaryProvider.MapDictionaryProvider()) + dict_provider.copyStructureFrom(json_reader, self.java_allocator) + with dict_provider: + self.java_arrow.c.Data.importIntoVectorSchemaRoot( + self.java_allocator, + self._wrap_c_array_ptr(c_array_ptr), + imported_batch, dict_provider) + self._assert_batches_equal(batch, imported_batch) + self._assert_dict_providers_equal(json_reader, dict_provider) @property def supports_releasing_memory(self):