wangyum commented on code in PR #3250:
URL: https://github.com/apache/parquet-java/pull/3250#discussion_r2200205094


##########
parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetFileReader.java:
##########
@@ -1667,7 +1667,14 @@ public BloomFilter readBloomFilter(ColumnChunkMetaData 
meta) throws IOException
     byte[] bitset;
     if (null == bloomFilterDecryptor) {
       bitset = new byte[numBytes];
-      in.read(bitset);
+      // For negative bloomFilterLength (files from older versions), use 
readFully() instead of read().
+      // readFully() guarantees reading exactly numBytes bytes, while read() 
may read fewer bytes in a single
+      // call. This ensures the entire bitset is properly loaded.
+      if (bloomFilterLength < 0) {

Review Comment:
   We already consume some data if bloomFilterLength > 0:
   
https://github.com/apache/parquet-java/blob/0e6eefba0889132c8554cec0ed437dcd3efaaade/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetFileReader.java#L1636-L1640
   
   So we can not use readFully here, and it will throw `java.io.EOFException` 
if using `readFully` for all cases:
   
https://github.com/apache/parquet-java/blob/eface4db2e961a0174d4d1cd809134262d8c4c76/parquet-hadoop/src/test/java/org/apache/parquet/hadoop/TestInteropBloomFilter.java#L131



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

Reply via email to