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/08/11 18:23:40 UTC

[GitHub] [beam] nikie commented on a change in pull request #15126: [BEAM-12665] Add option in ReadAll Transforms to add filename to the output

nikie commented on a change in pull request #15126:
URL: https://github.com/apache/beam/pull/15126#discussion_r687071732



##########
File path: sdks/python/apache_beam/io/filebasedsource.py
##########
@@ -377,8 +382,12 @@ def process(self, element, *args, **kwargs):
     if not source_list:
       return
     source = source_list[0].source
-    for record in source.read(range.new_tracker()):
-      yield record
+
+    if self._with_filename:
+      return [(metadata.path, record)
+              for record in source.read(range.new_tracker())]
+    else:
+      return [record for record in source.read(range.new_tracker())]

Review comment:
       Why are we changing yield to returning a list for the existing use case (without filename). Does this provide any advantages?




-- 
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