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 2022/07/29 18:56:14 UTC
[GitHub] [beam] tvalentyn commented on a diff in pull request #22419: Add zstd compression/decompression support
tvalentyn commented on code in PR #22419:
URL: https://github.com/apache/beam/pull/22419#discussion_r933532914
##########
sdks/python/apache_beam/io/filesystem.py:
##########
@@ -96,14 +102,19 @@ def mime_type(cls, compression_type, default='application/octet-stream'):
cls.BZIP2: 'application/x-bz2',
cls.DEFLATE: 'application/x-deflate',
cls.GZIP: 'application/x-gzip',
+ cls.ZSTD: 'application/x-zstd',
Review Comment:
nit: I think it's `application/zstd`
https://datatracker.ietf.org/doc/html/rfc8478
https://datatracker.ietf.org/doc/html/rfc6648#appendix-B
##########
sdks/python/setup.py:
##########
@@ -226,6 +226,7 @@ def get_portability_package_data():
'pytz>=2018.3',
'requests>=2.24.0,<3.0.0',
'typing-extensions>=3.7.0',
+ 'zstandard>=0.18.0',
Review Comment:
```suggestion
'zstandard>=0.18.0,<1',
```
##########
sdks/python/apache_beam/io/filesystem.py:
##########
@@ -166,6 +177,9 @@ def _initialize_decompressor(self):
self._decompressor = bz2.BZ2Decompressor()
elif self._compression_type == CompressionTypes.DEFLATE:
self._decompressor = zlib.decompressobj()
+ elif self._compression_type == CompressionTypes.ZSTD:
+ self._decompressor = zstandard.ZstdDecompressor(
+ max_window_size=2147483648).decompressobj()
Review Comment:
We should have some explanation here in a comment.
Is there a related bug/discussion with zstd maintainers that gives this recommendation from an authoritative source?
--
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