This is an automated email from the ASF dual-hosted git repository.

riteshghorse pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new 7610d46f745 Remove warning in dataframes io. (#29084)
7610d46f745 is described below

commit 7610d46f7456ccd7c311aed4c21105fcce27b7b5
Author: Robert Bradshaw <rober...@gmail.com>
AuthorDate: Fri Oct 20 06:17:11 2023 -0700

    Remove warning in dataframes io. (#29084)
---
 sdks/python/apache_beam/dataframe/io.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sdks/python/apache_beam/dataframe/io.py 
b/sdks/python/apache_beam/dataframe/io.py
index eb1b1b5ec15..fedc40c6071 100644
--- a/sdks/python/apache_beam/dataframe/io.py
+++ b/sdks/python/apache_beam/dataframe/io.py
@@ -281,8 +281,9 @@ class _ReadFromPandas(beam.PTransform):
       if not self.binary:
         handle = TextIOWrapper(handle)
       if self.incremental:
-        sample = next(
-            self.reader(handle, *self.args, **dict(self.kwargs, 
chunksize=100)))
+        with self.reader(handle, *self.args, **dict(self.kwargs,
+                                                    chunksize=100)) as stream:
+          sample = next(stream)
       else:
         sample = self.reader(handle, *self.args, **self.kwargs)
 

Reply via email to