aokolnychyi commented on code in PR #11463:
URL: https://github.com/apache/iceberg/pull/11463#discussion_r1828500703


##########
core/src/main/java/org/apache/iceberg/deletes/BitmapPositionDeleteIndex.java:
##########
@@ -92,4 +107,113 @@ public Collection<DeleteFile> deleteFiles() {
   public long cardinality() {
     return bitmap.cardinality();
   }
+
+  /**
+   * Serializes the index using the following format:
+   *
+   * <ul>
+   *   <li>The length of the magic bytes and bitmap stored as 4 bytes 
(big-endian).
+   *   <li>A 4-byte {@link #MAGIC_NUMBER} (little-endian).
+   *   <li>The bitmap serialized using the portable Roaring spec 
(little-endian).
+   *   <li>A CRC-32 checksum of the magic bytes and bitmap as 4-bytes 
(big-endian).
+   * </ul>
+   *
+   * Note that the length and the checksum are computed for the bitmap data, 
which includes the
+   * magic bytes and bitmap for compatibility with Delta.
+   */
+  @Override
+  public ByteBuffer serialize() {
+    bitmap.runLengthEncode(); // run-length encode the bitmap before 
serializing

Review Comment:
   We actually want to accumulate all values prior to applying run-length 
encoding, so doing this right before the serialization seems like a good place. 
We don't anticipate the bitmap to change after serialization.



-- 
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-unsubscr...@iceberg.apache.org

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


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

Reply via email to