sungwy commented on code in PR #3491:
URL: https://github.com/apache/iceberg-python/pull/3491#discussion_r3464169315


##########
pyiceberg/table/deletion_vector.py:
##########
@@ -0,0 +1,84 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+import math
+from typing import TYPE_CHECKING
+
+from pyroaring import BitMap, FrozenBitMap
+
+from pyiceberg.table.puffin import PuffinFile
+
+if TYPE_CHECKING:
+    import pyarrow as pa
+
+EMPTY_BITMAP = FrozenBitMap()
+MAX_JAVA_SIGNED = int(math.pow(2, 31)) - 1
+PROPERTY_REFERENCED_DATA_FILE = "referenced-data-file"
+
+
+class DeletionVector:
+    _deletion_vectors: dict[str, list[BitMap]]

Review Comment:
   Hi @ebyhr - I thought about this a bit more and I think we'd benefit from 
revisiting the class design.
   
   A single `PuffinFile` can hold multiple DVs, and that's read correctly here. 
But the `DeletionVector` class ends up encapsulating a map of deletion vectors 
(keyed by referenced-data-file), which I find a little counterintuitive given 
the name.
   
   Would it make sense to have `DeletionVector` map 1-1 to a single DV blob 
instead? That'd line up with Java, where one DV = one data file's 
`PositionDeleteIndex`, loaded via the entry's `content_offset`/`content_size`. 
The `from_puffin_file` function could then be moved to be a standalone function 
and return a list of DeletionVectors. WDYT?



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