geruh commented on code in PR #2822:
URL: https://github.com/apache/iceberg-python/pull/2822#discussion_r2605347832


##########
pyiceberg/table/puffin.py:
##########
@@ -114,3 +147,97 @@ 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:
+    _blobs: list[PuffinBlobMetadata]
+    _blob_payloads: list[bytes]
+
+    def __init__(self) -> None:
+        self._blobs = []
+        self._blob_payloads = []
+
+    def add(
+        self,
+        positions: Iterable[int],
+        referenced_data_file: str,
+    ) -> None:
+        # 1. Create bitmaps from positions
+        bitmaps: dict[int, BitMap] = {}
+        cardinality = 0
+        for pos in positions:
+            cardinality += 1

Review Comment:
   cardinality could be incorrect with same positions passed in



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