You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by lc...@apache.org on 2016/11/21 19:35:30 UTC

[2/4] incubator-beam git commit: Handling the 'collision' case for UIDs and also augmenting comments.

Handling the 'collision' case for UIDs and also augmenting comments.


Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/9f9c9865
Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/9f9c9865
Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/9f9c9865

Branch: refs/heads/python-sdk
Commit: 9f9c986500f769ebeb0baaf32f1a86334a36eec5
Parents: e85f67a
Author: Gus Katsiapis <ka...@katsiapis-linux.mtv.corp.google.com>
Authored: Sat Nov 19 15:22:47 2016 -0800
Committer: Luke Cwik <lc...@google.com>
Committed: Mon Nov 21 11:29:07 2016 -0800

----------------------------------------------------------------------
 sdks/python/apache_beam/io/fileio.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/9f9c9865/sdks/python/apache_beam/io/fileio.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/fileio.py b/sdks/python/apache_beam/io/fileio.py
index 1dcd622..cb7f25c 100644
--- a/sdks/python/apache_beam/io/fileio.py
+++ b/sdks/python/apache_beam/io/fileio.py
@@ -862,7 +862,11 @@ class FileSink(iobase.Sink):
 
   def open_writer(self, init_result, uid):
     # A proper suffix is needed for AUTO compression detection.
-    suffix = os.path.basename(self.file_path_prefix) + self.file_name_suffix
+    # We also ensure there will be no collisions with uid and a
+    # (possibly unsharded) file_path_prefix and a (possibly empty)
+    # file_name_suffix.
+    suffix = (
+      '.' + os.path.basename(self.file_path_prefix) + self.file_name_suffix)
     return FileSinkWriter(self, os.path.join(init_result, uid) + suffix)
 
   def finalize_write(self, init_result, writer_results):