moomindani commented on code in PR #3474:
URL: https://github.com/apache/iceberg-python/pull/3474#discussion_r3456210419
##########
pyiceberg/table/puffin.py:
##########
@@ -114,3 +152,99 @@ def __init__(self, puffin: bytes) -> None:
def to_vector(self) -> dict[str, "pa.ChunkedArray"]:
return {path: _bitmaps_to_chunked_array(bitmaps) for path, bitmaps in
self._deletion_vectors.items()}
+
+
+class PuffinWriter:
+ """Writes a Puffin file containing a single deletion-vector-v1 blob to an
output file."""
+
+ _output_file: OutputFile
+ _blobs: list[PuffinBlobMetadata]
+ _blob_payloads: list[bytes]
+ _created_by: str
+
+ def __init__(self, output_file: OutputFile, created_by: str | None = None)
-> None:
+ self._output_file = output_file
+ self._blobs = []
+ self._blob_payloads = []
+ self._created_by = (
+ created_by if created_by is not None else f"PyIceberg version
{importlib.metadata.version('pyiceberg')}"
Review Comment:
Thanks, that makes sense — switched to `from pyiceberg import __version__`
to match the existing pattern in `cli/console.py` and to avoid the
`PackageNotFoundError` from `importlib.metadata.version` when pyiceberg isn't
pip-installed. Updated the test accordingly.
##########
pyiceberg/table/puffin.py:
##########
@@ -114,3 +152,99 @@ def __init__(self, puffin: bytes) -> None:
def to_vector(self) -> dict[str, "pa.ChunkedArray"]:
return {path: _bitmaps_to_chunked_array(bitmaps) for path, bitmaps in
self._deletion_vectors.items()}
+
+
+class PuffinWriter:
Review Comment:
Sounds good to me. I'll wait for #3491 to land and then rebase this on top
of it, renaming the writer to `DeletionVectorWriter` as part of that. Thanks
both!
--
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]