From 98bf7ec3ef3c0398385928d4b99295054de69143 Mon Sep 17 00:00:00 2001 From: Adrian Ehrsam Date: Wed, 13 Mar 2024 13:57:57 +0100 Subject: [PATCH] revert 965968cda0d3d6cace62905b5af5437960ea851a and 965968cda0d3d6cace62905b5af5437960ea851a --- python/src/lib.rs | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/python/src/lib.rs b/python/src/lib.rs index 3b21eba133..1b81eeab6f 100644 --- a/python/src/lib.rs +++ b/python/src/lib.rs @@ -1385,20 +1385,6 @@ impl From<&PyAddAction> for Add { } } -struct GilIterator { - reader: ArrowArrayStreamReader, -} - -impl Iterator for GilIterator { - type Item = RecordBatch; - - fn next(&mut self) -> Option { - let reader = &mut self.reader; - - Python::with_gil(|_| reader.next().map(|v| v.unwrap())) - } -} - #[pyfunction] #[allow(clippy::too_many_arguments)] fn write_to_deltalake( @@ -1419,7 +1405,7 @@ fn write_to_deltalake( custom_metadata: Option>, ) -> PyResult<()> { py.allow_threads(|| { - let batches = GilIterator { reader: data.0 }; // The pyarrow reader can be backed by a python object + let batches = data.0.map(|batch| batch.unwrap()); let save_mode = mode.parse().map_err(PythonError::from)?; let options = storage_options.clone().unwrap_or_default();