amogh-jahagirdar commented on code in PR #18544:
URL: https://github.com/apache/iceberg/pull/18544#discussion_r4303424859
##########
core/src/main/java/org/apache/iceberg/mumbling/MumblingBitmap.java:
##########
@@ -51,23 +64,23 @@ class MumblingBitmap implements ManifestBitmap {
private volatile int[] offsets = null;
MumblingBitmap(ByteBuffer data) {
- int version = data.get(data.position()) & 0xFF;
+ int version = ByteBuffers.readByte(data, 0);
if (version != VERSION) {
throw new UnsupportedOperationException("Unsupported Mumbling bitmap
version: " + version);
}
this.data = data;
- this.cardinality =
- (data.get(data.position() + 1) & 0xFF)
- | ((data.get(data.position() + 2) & 0xFF) << 8)
- | ((data.get(data.position() + 3) & 0xFF) << 16);
- this.containerCount =
- (data.get(data.position() + 4) & 0xFF) | ((data.get(data.position() +
5) & 0xFF) << 8);
+ this.cardinality = ByteBuffers.readLittleEndianUnsigned(data, 1, 3);
+ this.containerCount = ByteBuffers.readLittleEndianUnsigned(data, 4, 2);
Preconditions.checkState(
- containerCount <= 8192, "Invalid container count: %s > 8,192 (max)",
containerCount);
+ containerCount < MAX_CONTAINER_COUNT,
Review Comment:
Yeah maybe worth a test that tests a bitmap with all the containers up to
this limit
--
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]