fenfeng9 commented on code in PR #49334:
URL: https://github.com/apache/arrow/pull/49334#discussion_r2993456183


##########
cpp/src/parquet/bloom_filter.cc:
##########
@@ -104,6 +127,139 @@ static ::arrow::Status ValidateBloomFilterHeader(
   return ::arrow::Status::OK();
 }
 
+BlockSplitBloomFilter DeserializeEncryptedFromStream(
+    const ReaderProperties& properties, ArrowInputStream* input,
+    std::optional<int64_t> bloom_filter_length, Decryptor* decryptor,
+    int16_t row_group_ordinal, int16_t column_ordinal) {
+  ThriftDeserializer deserializer(properties);
+  format::BloomFilterHeader header;
+
+  // Read the length-prefixed ciphertext for the header.
+  PARQUET_ASSIGN_OR_THROW(auto length_buf, input->Read(kCiphertextLengthSize));
+  if (ARROW_PREDICT_FALSE(length_buf->size() < kCiphertextLengthSize)) {

Review Comment:
   Thanks, that makes sense. I kept this as a short-read helper for now, since 
the duplicated checks are all `actual` < `expected`. The actual != expected 
case felt different, so I left it separate.
   
   Thanks again for the patient and careful review.
   ```cpp
   void CheckBloomFilterShortRead(int64_t expected, int64_t actual,
                                  std::string_view context) {
     if (ARROW_PREDICT_FALSE(actual < expected)) {
       std::stringstream ss;
       ss << context << " read failed: expected ";
       ss << expected << " bytes, got " << actual;
       throw ParquetException(ss.str());
     }
   }
   ```



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