You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2021/10/25 07:08:24 UTC

[GitHub] [beam] dmitriikuzinepam commented on a change in pull request #15775: [BEAM-12730] Python. Custom delimiter add corner case

dmitriikuzinepam commented on a change in pull request #15775:
URL: https://github.com/apache/beam/pull/15775#discussion_r735311883



##########
File path: sdks/python/apache_beam/io/textio.py
##########
@@ -257,17 +259,37 @@ def _find_separator_bounds(self, file_to_read, read_buffer):
 
       # Using find() here is more efficient than a linear scan
       # of the byte array.
-      next_lf = read_buffer.data.find(self._delimiter, current_pos)
+      next_lf = read_buffer.data.find(delimiter, current_pos)
 
       if next_lf >= 0:
-        if self._delimiter == b'\n' and read_buffer.data[next_lf -
-                                                         1:next_lf] == b'\r':
+        if self._delimiter is None and delimiter == b'\n' \
+                and read_buffer.data[next_lf - 1:next_lf] == b'\r':
+          # Default delimiter

Review comment:
       > # User defined delimiter
   It is in next [else](https://github.com/apache/beam/blob/c167d0a844012cacf4a1b7ec16fed8a2752a48ef/sdks/python/apache_beam/io/textio.py#L270) 




-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org