You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "Fokko (via GitHub)" <gi...@apache.org> on 2023/07/04 11:06:11 UTC

[GitHub] [iceberg] Fokko opened a new pull request, #7984: Python: Add gzip metadata support

Fokko opened a new pull request, #7984:
URL: https://github.com/apache/iceberg/pull/7984

   Resolves #7977


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] Fokko merged pull request #7984: Python: Add gzip metadata support

Posted by "Fokko (via GitHub)" <gi...@apache.org>.
Fokko merged PR #7984:
URL: https://github.com/apache/iceberg/pull/7984


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] rdblue commented on a diff in pull request #7984: Python: Add gzip metadata support

Posted by "rdblue (via GitHub)" <gi...@apache.org>.
rdblue commented on code in PR #7984:
URL: https://github.com/apache/iceberg/pull/7984#discussion_r1252390419


##########
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:
   Is `get` adding any value in this API? I generally omit it or replace it with a more specific verb.



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] Fokko commented on a diff in pull request #7984: Python: Add gzip metadata support

Posted by "Fokko (via GitHub)" <gi...@apache.org>.
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, force 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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] Fokko commented on a diff in pull request #7984: Python: Add gzip metadata support

Posted by "Fokko (via GitHub)" <gi...@apache.org>.
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] rdblue commented on pull request #7984: Python: Add gzip metadata support

Posted by "rdblue (via GitHub)" <gi...@apache.org>.
rdblue commented on PR #7984:
URL: https://github.com/apache/iceberg/pull/7984#issuecomment-1620799248

   Looks good to me. Thanks, @Fokko!


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org