corwinjoy commented on code in PR #39677:
URL: https://github.com/apache/arrow/pull/39677#discussion_r1456667574


##########
cpp/src/generated/parquet_types.cpp:
##########
@@ -8481,11 +8501,27 @@ uint32_t 
FileMetaData::read(::apache::thrift::protocol::TProtocol* iprot) {
             uint32_t _size326;
             ::apache::thrift::protocol::TType _etype329;
             xfer += iprot->readListBegin(_etype329, _size326);
+            if(read_only_rowgroup_0) {
+              this->row_groups.resize(1);
+            } else {
             this->row_groups.resize(_size326);
+            }
+
             uint32_t _i330;
+            uint32_t rowgroup_size;
             for (_i330 = 0; _i330 < _size326; ++_i330)
             {
-              xfer += this->row_groups[_i330].read(iprot);
+              rowgroup_size = this->row_groups[_i330].read(iprot);
+              xfer += rowgroup_size;
+              if(read_only_rowgroup_0) {
+                break;
+              }
+            }
+            if(read_only_rowgroup_0) {
+              // skip the remaining rowgroups
+              uint32_t skip_len = (_size326 -1) * rowgroup_size;
+              skip_bytes(iprot, skip_len);
+              xfer += skip_len;

Review Comment:
   (Background on the compact thrift protocol and why it may give variable size 
encodings for rowgroups: 
https://github.com/apache/thrift/blob/master/doc/specs/thrift-compact-protocol.md).



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