tachyonwill commented on a change in pull request #12365:
URL: https://github.com/apache/arrow/pull/12365#discussion_r801164114



##########
File path: cpp/src/parquet/encoding.cc
##########
@@ -2181,12 +2181,14 @@ class DeltaBitPackDecoder : public DecoderImpl, virtual 
public TypedDecoder<DTyp
   }
 
   int GetInternal(T* buffer, int max_values) {
-    max_values = std::min(max_values, this->num_values_);
+    int total_value_count = static_cast<int>(std::min(
+        total_value_count_, 
static_cast<uint32_t>(std::numeric_limits<int>::max())));
+    max_values = std::min(max_values, total_value_count);
+    DCHECK_GE(max_values, 0);

Review comment:
       I worry that this is the wrong place to put it though. The basic 
contract of these decoders seems to be, 'give me how many values you want, I 
will give you min(what you want, what is left) and then return how many were 
actually given'. Changing this one to throw an exception if 'what you want > 
what is left' would make it unlike the others, even if I only expect the caller 
to request more than is what is available if the caller has a bug or the file 
is malformed.




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