Fokko commented on code in PR #7984:
URL: https://github.com/apache/iceberg/pull/7984#discussion_r1252662748


##########
python/pyiceberg/serializers.py:
##########
@@ -14,27 +14,72 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+from __future__ import annotations
 
 import codecs
+import gzip
 import json
+from abc import ABC, abstractmethod
+from typing import Callable
 
 from pyiceberg.io import InputFile, InputStream, OutputFile
 from pyiceberg.table.metadata import TableMetadata, TableMetadataUtil
 
+GZIP = "gzip"
+
+
+class Compressor(ABC):
+    @staticmethod
+    def get_compressor(location: str) -> Compressor:
+        return GzipCompressor() if location.endswith(".gz.metadata.json") else 
NOOP_COMPRESSOR
+
+    @abstractmethod
+    def get_stream_decompressor(self, inp: InputStream) -> InputStream:
+        return inp
+
+    @abstractmethod
+    def get_bytes_compressor(self) -> Callable[[bytes], bytes]:
+        pass
+
+
+class NoopCompressor(Compressor):
+    def get_stream_decompressor(self, inp: InputStream) -> InputStream:
+        return inp
+
+    def get_bytes_compressor(self) -> Callable[[bytes], bytes]:

Review Comment:
   Thanks, for of habit!



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to