sfc-gh-nthimmegowda commented on code in PR #14147:
URL: https://github.com/apache/arrow/pull/14147#discussion_r973666835


##########
cpp/src/parquet/encoding.cc:
##########
@@ -2355,6 +2355,83 @@ class DeltaLengthByteArrayDecoder : public DecoderImpl,
   std::shared_ptr<ResizableBuffer> buffered_data_;
 };
 
+// ----------------------------------------------------------------------
+// RLE_BOOLEAN_DECODER
+
+class RleBooleanDecoder : public DecoderImpl,  virtual public BooleanDecoder {
+
+  public:
+    explicit RleBooleanDecoder(const ColumnDescriptor* descr)
+            :DecoderImpl(descr, Encoding::RLE) {}
+
+    void SetData(int num_values, const uint8_t* data, int len) override {
+      num_values_ = num_values;
+      int32_t num_bytes = 0;
+
+      if (len < 4) {
+        throw ParquetException("Received invalid length (corrupt data page?)");
+      }
+      // Load the first 4 bytes, which indicates the legnth
+      num_bytes = ::arrow::util::SafeLoadAs<int32_t>(data);
+      if (num_bytes < 0 || num_bytes > len - 4) {
+        throw ParquetException("Received invalid number of bytes (corrupt data 
page?)");
+      }
+
+      const uint8_t* decoder_data = data + 4;
+      if (len == 0) {

Review Comment:
   Agreed. This check is unnecessary. Removed. 



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to