wgtmac commented on code in PR #1043:
URL: https://github.com/apache/parquet-mr/pull/1043#discussion_r1142942382


##########
parquet-column/src/main/java/org/apache/parquet/column/impl/ColumnWriterBase.java:
##########
@@ -97,7 +97,7 @@ abstract class ColumnWriterBase implements ColumnWriter {
       int optimalNumOfBits = 
BlockSplitBloomFilter.optimalNumOfBits(ndv.getAsLong(), fpp.getAsDouble());
       this.bloomFilter = new BlockSplitBloomFilter(optimalNumOfBits / 8, 
maxBloomFilterSize);
     } else {
-      this.bloomFilter = new BlockSplitBloomFilter(maxBloomFilterSize);
+      this.bloomFilter = BlockSplitBloomFilter.of(maxBloomFilterSize);

Review Comment:
   OK, I got your point. According to the delegate constructor below, 
`LOWER_BOUND_BYTES` and `UPPER_BOUND_BYTES` are hard limits. What about 
checking if `minimumBytes` and `maximumBytes` are power of two and throw if not?
   
   ```java
     public BlockSplitBloomFilter(int numBytes, int minimumBytes, int 
maximumBytes, HashStrategy hashStrategy) {
       if (minimumBytes > maximumBytes) {
         throw new IllegalArgumentException("the minimum bytes should be less 
or equal than maximum bytes");
       }
   
       if (minimumBytes > LOWER_BOUND_BYTES && minimumBytes < 
UPPER_BOUND_BYTES) {
         this.minimumBytes = minimumBytes;
       }
   
       if (maximumBytes > LOWER_BOUND_BYTES && maximumBytes < 
UPPER_BOUND_BYTES) {
         this.maximumBytes = maximumBytes;
       }
   
       initBitset(numBytes);
   
       cacheBuffer.order(ByteOrder.LITTLE_ENDIAN);
   
       switch (hashStrategy) {
         case XXH64:
           this.hashStrategy = hashStrategy;
           hashFunction = new XxHash();
           break;
         default:
           throw new RuntimeException("Unsupported hash strategy");
       }
     }
   ``` 



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

Reply via email to