rok commented on code in PR #14341:
URL: https://github.com/apache/arrow/pull/14341#discussion_r1256700473
##########
cpp/src/parquet/encoding.cc:
##########
@@ -1275,6 +1287,40 @@ struct ArrowBinaryHelper {
int64_t chunk_space_remaining;
};
+template <>
+struct ArrowBinaryHelper<FLBAType> {
+ explicit ArrowBinaryHelper(EncodingTraits<FLBAType>::Accumulator* builder) {
+ this->builder = builder;
+ if (ARROW_PREDICT_FALSE(SubtractWithOverflow(::arrow::kBinaryMemoryLimit,
+
this->builder->value_data_length(),
+
&this->chunk_space_remaining))) {
+ throw ParquetException("excess expansion in
ArrowBinaryHelper<FLBAType>");
+ }
+ }
+
+ Status PushChunk() {
+ std::shared_ptr<::arrow::Array> result;
+ RETURN_NOT_OK(builder->Finish(&result));
+ chunks.push_back(std::move(result));
+ chunk_space_remaining = ::arrow::kBinaryMemoryLimit;
+ return Status::OK();
+ }
+
+ bool CanFit(int64_t length) const { return length <= chunk_space_remaining; }
+
+ Status Append(const uint8_t* data, int32_t length) {
+ DCHECK(CanFit(length));
+ chunk_space_remaining -= length;
+ return builder->Append(data);
+ }
+
+ Status AppendNull() { return builder->AppendNull(); }
+
+ ::arrow::FixedSizeBinaryBuilder* builder;
+ std::vector<std::shared_ptr<::arrow::Array>> chunks;
Review Comment:
I don't think we discussed it. I've used your suggestion.
--
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]