This is an automated email from the ASF dual-hosted git repository.
tvalentyn 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 48c9e1f9b38 fix(dataframe): claim remaining restriction range on
empty/header-only CSV reads (#39581)
48c9e1f9b38 is described below
commit 48c9e1f9b389e41ea2390817703fed5c30eda559
Author: Manvith Panyam <[email protected]>
AuthorDate: Thu Aug 6 00:59:47 2026 +0530
fix(dataframe): claim remaining restriction range on empty/header-only CSV
reads (#39581)
Signed-off-by: ManvithPanyam
<[email protected]>
---
sdks/python/apache_beam/dataframe/io.py | 1 +
sdks/python/apache_beam/dataframe/io_test.py | 6 ++++++
2 files changed, 7 insertions(+)
diff --git a/sdks/python/apache_beam/dataframe/io.py
b/sdks/python/apache_beam/dataframe/io.py
index bc39a40403f..55a36466e57 100644
--- a/sdks/python/apache_beam/dataframe/io.py
+++ b/sdks/python/apache_beam/dataframe/io.py
@@ -565,6 +565,7 @@ class _TruncatingFileHandle(object):
self._buffer = self._underlying.read(size)
if not self._buffer:
+ self._tracker.try_claim(self._tracker.current_restriction().stop)
self._done = True
return self._empty
diff --git a/sdks/python/apache_beam/dataframe/io_test.py
b/sdks/python/apache_beam/dataframe/io_test.py
index dd7b8db497c..051a85b379f 100644
--- a/sdks/python/apache_beam/dataframe/io_test.py
+++ b/sdks/python/apache_beam/dataframe/io_test.py
@@ -122,6 +122,12 @@ A B
pcoll = p | beam.io.ReadFromCsv(f'{input}tmp.csv', dtype=str)
assert_that(pcoll | beam.Map(max), equal_to(['99']))
+ def test_empty_csv_read(self):
+ input = self.temp_dir({'empty.csv': 'col1,col2,col3\n'})
+ with beam.Pipeline() as p:
+ pcoll = p | beam.io.ReadFromCsv(input + 'empty.csv')
+ assert_that(pcoll, equal_to([]))
+
def test_sharding_parameters(self):
data = pd.DataFrame({'label': ['11a', '37a', '389a'], 'rank': [0, 1, 2]})
output = self.temp_dir()