TheNeuralBit commented on a change in pull request #16066:
URL: https://github.com/apache/beam/pull/16066#discussion_r758358147
##########
File path: sdks/python/apache_beam/dataframe/io.py
##########
@@ -521,10 +535,15 @@ def create_tracker(self, restriction):
return beam.io.restriction_trackers.UnsplittableRestrictionTracker(
tracker)
- def process(self, readable_file, tracker=beam.DoFn.RestrictionParam()):
+ def process(
+ self, readable_file, path_indices, tracker=beam.DoFn.RestrictionParam()):
reader = self.reader
if isinstance(reader, str):
reader = getattr(pd, self.reader)
+ start_index = (
+ tracker.current_restriction().start +
+ path_indices[readable_file.metadata.path] *
+ 10**int(math.log(2**64 // len(path_indices), 10)))
Review comment:
IIUC, this finds the order of magnitude of `2**64 // len(path_indices)`.
So it could be substantially smaller than the largest file we can support (e.g.
9999 -> 1000).
Should there be some logic to handle the case where a file is too large and
will produce collisions? I'm not sure what we could do in that case though.
##########
File path: sdks/python/apache_beam/dataframe/io.py
##########
@@ -263,10 +277,10 @@ def expand(self, root):
self.kwargs,
self.binary,
self.incremental,
- self.splitter)))
+ self.splitter),
+ path_indices=beam.pvalue.AsSingleton(indices_pcoll)))
Review comment:
Great idea to track the path_indices and use that to avoid collisions.
--
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]