You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by jo...@apache.org on 2023/04/12 15:12:43 UTC
[beam] branch master updated: update documentation (#26201)
This is an automated email from the ASF dual-hosted git repository.
johncasey 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 9e2b2d9ae2d update documentation (#26201)
9e2b2d9ae2d is described below
commit 9e2b2d9ae2de1b247383904fdef59473e0e14cfd
Author: Ahmed Abualsaud <65...@users.noreply.github.com>
AuthorDate: Wed Apr 12 18:12:36 2023 +0300
update documentation (#26201)
---
sdks/python/apache_beam/io/textio.py | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/sdks/python/apache_beam/io/textio.py b/sdks/python/apache_beam/io/textio.py
index abfeb9bc979..1274412ee14 100644
--- a/sdks/python/apache_beam/io/textio.py
+++ b/sdks/python/apache_beam/io/textio.py
@@ -61,8 +61,9 @@ class _TextSource(filebasedsource.FileBasedSource):
Parses a text file as newline-delimited elements. Supports newline delimiters
'\n' and '\r\n.
- This implementation only supports reading text encoded using UTF-8 or
- ASCII.
+ This implementation reads encoded text and uses the input coder's encoding to
+ decode from bytes to str. This does not support ``UTF-16`` or ``UTF-32``
+ encodings.
"""
DEFAULT_READ_BUFFER_SIZE = 8192
@@ -571,8 +572,12 @@ class ReadAllFromText(PTransform):
similar to ``ReadFromTextWithFilename`` but this ``PTransform`` can be placed
anywhere in the pipeline.
- This implementation only supports reading text encoded using UTF-8 or ASCII.
- This does not support other encodings such as UTF-16 or UTF-32.
+ If reading from a text file that that requires a different encoding, you may
+ provide a custom :class:`~apache_beam.coders.coders.Coder` that encodes and
+ decodes with the appropriate codec. For example, see the implementation of
+ :class:`~apache_beam.coders.coders.StrUtf8Coder`.
+
+ This does not support ``UTF-16`` or ``UTF-32`` encodings.
This implementation is only tested with batch pipeline. In streaming,
reading may happen with delay due to the limitation in ReShuffle involved.
@@ -719,11 +724,14 @@ class ReadFromText(PTransform):
Parses a text file as newline-delimited elements, by default assuming
``UTF-8`` encoding. Supports newline delimiters ``\n`` and ``\r\n``
- or specified delimiter .
+ or specified delimiter.
+
+ If reading from a text file that that requires a different encoding, you may
+ provide a custom :class:`~apache_beam.coders.coders.Coder` that encodes and
+ decodes with the appropriate codec. For example, see the implementation of
+ :class:`~apache_beam.coders.coders.StrUtf8Coder`.
- This implementation only supports reading text encoded using ``UTF-8`` or
- ``ASCII``.
- This does not support other encodings such as ``UTF-16`` or ``UTF-32``.
+ This does not support ``UTF-16`` or ``UTF-32`` encodings.
"""
_source_class = _TextSource