derrickaw commented on code in PR #38484:
URL: https://github.com/apache/beam/pull/38484#discussion_r3236133185
##########
sdks/python/apache_beam/dataframe/io.py:
##########
@@ -684,13 +684,22 @@ def expand(self, pcoll):
dir, name = self.path, ''
else:
dir, name = io.filesystems.FileSystems.split(self.path)
+ num_shards = self.kwargs.pop('num_shards', None)
+ max_writers_per_bundle = self.kwargs.pop('max_writers_per_bundle', None)
+ write_to_files_kwargs = {}
+ if num_shards is not None:
+ write_to_files_kwargs['shards'] = num_shards
+ write_to_files_kwargs['max_writers_per_bundle'] = (
+ 0 if max_writers_per_bundle is None else max_writers_per_bundle)
+ elif max_writers_per_bundle is not None:
+ write_to_files_kwargs['max_writers_per_bundle'] = max_writers_per_bundle
return pcoll | fileio.WriteToFiles(
path=dir,
- shards=self.kwargs.pop('num_shards', None),
file_naming=self.kwargs.pop(
'file_naming', fileio.default_file_naming(name)),
sink=lambda _: _WriteToPandasFileSink(
- self.writer, self.args, self.kwargs, self.incremental,
self.binary))
+ self.writer, self.args, self.kwargs, self.incremental,
self.binary),
+ **write_to_files_kwargs)
Review Comment:
done
--
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]