Skip to content

Commit 4e204c7

Browse files
committed
(contd.) fix: if the max ordinal for a map value is zero then reserve 1 bit for it instead of nothing
1 parent 2ba691b commit 4e204c7

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
package com.netflix.hollow.api.producer.validation;public class PrimaryKeyViolationValidator {
2+
}

hollow/src/main/java/com/netflix/hollow/core/write/HollowMapTypeWriteState.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ private void calculateNumShards() {
185185
}
186186

187187
long bitsPerKeyElement = 64 - Long.numberOfLeadingZeros(maxKeyOrdinal + 1);
188-
long bitsPerValueElement = 64 - Long.numberOfLeadingZeros(maxValueOrdinal);
188+
long bitsPerValueElement = maxValueOrdinal == 0 ? 1 : 64 - Long.numberOfLeadingZeros(maxValueOrdinal);
189189
long bitsPerMapSizeValue = 64 - Long.numberOfLeadingZeros(maxMapSize);
190190
long bitsPerMapPointer = 64 - Long.numberOfLeadingZeros(totalOfMapBuckets);
191191

0 commit comments

Comments
 (0)