Fokko commented on code in PR #3575:
URL: https://github.com/apache/iceberg-python/pull/3575#discussion_r3531528120


##########
pyiceberg/table/puffin.py:
##########
@@ -68,7 +69,12 @@ def __init__(self, puffin: bytes) -> None:
         self._file_bytes = puffin
 
     def get_blob_payload(self, blob: PuffinBlobMetadata) -> bytes:
-        return self._file_bytes[blob.offset : blob.offset + blob.length]
+        raw = self._file_bytes[blob.offset : blob.offset + blob.length]
+        if blob.compression_codec is None:
+            return raw
+        if blob.compression_codec == "zstd":
+            return zstandard.ZstdDecompressor().decompress(raw)
+        raise ValueError(f"Unsupported compression codec: 
{blob.compression_codec!r}")

Review Comment:
   nit on style, for me this makes the flow more explicit:
   ```suggestion
           if blob.compression_codec is None:
               return raw
           elif blob.compression_codec == "zstd":
               return zstandard.ZstdDecompressor().decompress(raw)
           else:
               raise ValueError(f"Unsupported puffin compression codec: 
{blob.compression_codec!r}")
   ```



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