rok commented on code in PR #14341:
URL: https://github.com/apache/arrow/pull/14341#discussion_r1195472664
##########
cpp/src/parquet/encoding.cc:
##########
@@ -1238,25 +1240,35 @@ int PlainBooleanDecoder::Decode(bool* buffer, int
max_values) {
return max_values;
}
-struct ArrowBinaryHelper {
+template <typename DType>
+struct ArrowBinaryHelper;
+
+template <>
+struct ArrowBinaryHelper<ByteArrayType> {
explicit ArrowBinaryHelper(typename
EncodingTraits<ByteArrayType>::Accumulator* out) {
this->out = out;
this->builder = out->builder.get();
+ if (ARROW_PREDICT_FALSE(SubtractWithOverflow(::arrow::kBinaryMemoryLimit,
+
this->builder->value_data_length(),
+
&this->chunk_space_remaining))) {
Review Comment:
`kBinaryMemoryLimit` is `int32_t` while `this->builder->value_data_length()`
is `int64_t`, see definitions below. Not sure how how often would the builder
grow to `std::numeric_limits<int32_t>::max()` though. I'm happy to switch to
regular subtraction if desired.
```cpp
constexpr int64_t kBinaryMemoryLimit = std::numeric_limits<int32_t>::max() -
1;
```
```cpp
int64_t value_data_length() const { return byte_builder_.length(); }
```
--
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]