xndai opened a new pull request, #1195: URL: https://github.com/apache/iceberg-cpp/pull/1195
Closes #1194. Part of #1107. Adds the write side of the [Mumbling bitmap format](https://github.com/apache/iceberg/blob/main/format/mumbling-spec.md) (a draft spec, apache/iceberg#16518) for v4 manifest deletion vectors (`manifest_info.dv`, `tracking.deleted_positions` and `tracking.replaced_positions`). It sits next to the reader from #1126 in `util/mumbling_bitmap_internal.h`. `MutableMumblingBitmap` matches Java's `MutableBitmap` (apache/iceberg#18138): - `Set(pos)` adds a position and reports whether it was new. - `Merge(view)` adds every position of an existing bitmap. - `Serialize()` writes format version 1. As in Java, containers with fewer than 32 positions are written sparse and the rest dense. `EncodePforBytes()` picks the PFOR bit widths ([Appendix A](https://github.com/apache/iceberg/blob/main/format/mumbling-spec.md#appendix-a-pfor-encoding-for-unsigned-bytes)) the way the Java encoder does, so the output matches Java byte for byte. Tests check the output against the Java-generated fixtures from #1126 (130 PFOR vectors and 6 bitmaps). They also round-trip empty, contiguous, clustered, random and maximum-size bitmaps through `MumblingBitmapView`, and cover merging bitmaps of different sizes and invalid positions. `BM_PforEncode`, `BM_Set` and `BM_Serialize` are added to `mumbling_bitmap_benchmark`. Benchmark against the Java writer on the same positions (Release; gcc-14 with Google Benchmark, JDK 17 with JMH; Xeon Platinum 8175M): | Operation | C++ | Java | |---|---:|---:| | `Set` 100,000 random positions | 0.92 ms | 6.85 ms | | `Set` all 2,097,152 positions | 16.2 ms | 120 ms | | `Serialize`, 1,000 random positions | 47 µs | 62 µs | | `Serialize`, 100,000 random positions | 594 µs | 428 µs | | `Serialize`, all 2,097,152 positions | 34 µs | 247 µs | C++ keeps each container as a bit set, so `Set` is constant-time but writing a sparse container needs a bit scan. Java keeps sparse containers as sorted lists, which is why it serializes the random 100,000-position bitmap faster. -- 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]
