emkornfield commented on code in PR #13275:
URL: https://github.com/apache/arrow/pull/13275#discussion_r890885939


##########
cpp/src/parquet/thrift_internal.h:
##########
@@ -350,74 +351,84 @@ static inline format::EncryptionAlgorithm 
ToThrift(EncryptionAlgorithm encryptio
 
 using ThriftBuffer = apache::thrift::transport::TMemoryBuffer;
 
-// On Thrift 0.14.0+, we want to use TConfiguration to raise the max message 
size
-// limit (ARROW-13655).  If we wanted to protect against huge messages, we 
could
-// do it ourselves since we know the message size up front.
+class ThriftDeserializer {
+ public:
+  explicit ThriftDeserializer(const ReaderProperties& properties)
+      : ThriftDeserializer(properties.thrift_string_size_limit(),
+                           properties.thrift_container_size_limit()) {}
+
+  ThriftDeserializer(int32_t string_size_limit, int32_t container_size_limit)
+      : string_size_limit_(string_size_limit),
+        container_size_limit_(container_size_limit) {}
 
-inline std::shared_ptr<ThriftBuffer> CreateReadOnlyMemoryBuffer(uint8_t* buf,
-                                                                uint32_t len) {
+  // Deserialize a thrift message from buf/len.  buf/len must at least contain
+  // all the bytes needed to store the thrift message.  On return, len will be
+  // set to the actual length of the header.
+  template <class T>
+  void DeserializeMessage(const uint8_t* buf, uint32_t* len, T* 
deserialized_msg,
+                          const std::shared_ptr<Decryptor>& decryptor = 
NULLPTR) {

Review Comment:
   why shared_ptr here?  If this is needed for async operations doesn't a copy 
of the shared_ptr need to be taken?  If it isn't pass by normal pointer?



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