JustinBinber opened a new pull request, #41622: URL: https://github.com/apache/beam/pull/41622
Fixes #41621. Compressed files currently return at most 16 MiB from a default `read()`. `fileio.ReadableFile.read()` and `read_utf8()` each perform one such read, so larger content can be silently truncated. Explicit `read(None)` raises and `read(-1)` can return empty data before reading the source. Change the default to an unlimited read and drain the existing decompression buffer to EOF for omitted, `None` or negative sizes. Explicit nonnegative sizes keep their bounded behavior. Clamp negative absolute seek offsets to zero before skipping, so seek never interprets a negative distance as an unlimited read. No codec-specific logic or dependencies change. Regression tests cover all five codecs, partial reads, empty streams, EOF, rewind and concatenated members. A real `ReadMatches` pipeline checks both public `ReadableFile` readers with a 16 MiB gzip member followed by a final row. The old code returns 16,777,216 bytes instead of 16,777,225. Validation on Windows / Python 3.11.7: - New regression nodes fail against unchanged production code, then pass with the fix. - Complete `filesystem_test.py` and `localfilesystem_test.py`, plus `fileio_test.py::ReadTest`, `WriteFilesTest` and `textio_test.py::TextSinkTest`: 138 passed, 1 existing skip and 55 subtests passed on FnApiRunner, excluding one TestStream test unsupported by that runner. That test passes separately on BundleBasedDirectRunner (139 passed in total). - YAPF 0.43.0, Ruff 0.15.22, Pyrefly 1.1.1 (0 errors) and `git diff --check` pass. The source checkout used generated protobuf bindings from the released 2.78.0 wheel; a fresh SDK/protobuf build, cloud execution and the full runner matrix were not run. Exploratory tests also reproduced existing zstd/lzma concatenated-frame chunk-boundary errors on the unchanged base with bounded reads; those are outside this change. Unlimited reads use memory proportional to the remaining decompressed data. Callers needing bounded reads can continue to pass an explicit size. This does not address the separate CSV restriction-size issue in #41471. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
