rok commented on code in PR #14191:
URL: https://github.com/apache/arrow/pull/14191#discussion_r1019561103
##########
cpp/src/parquet/encoding.cc:
##########
@@ -2062,6 +2064,202 @@ class DictByteArrayDecoderImpl : public
DictDecoderImpl<ByteArrayType>,
}
};
+// ----------------------------------------------------------------------
+// DeltaBitPackEncoder
+
+template <typename DType>
+class DeltaBitPackEncoder : public EncoderImpl, virtual public
TypedEncoder<DType> {
+ public:
+ using T = typename DType::c_type;
+
+ explicit DeltaBitPackEncoder(const ColumnDescriptor* descr, MemoryPool* pool)
+ : EncoderImpl(descr, Encoding::DELTA_BINARY_PACKED, pool),
+ values_per_block_(128),
+ mini_blocks_per_block_(4),
+ values_per_mini_block_(values_per_block_ / mini_blocks_per_block_),
+ values_current_block_(0),
+ total_value_count_(0),
+ first_value_(0),
+ current_value_(0),
+ sink_(pool),
+ bits_buffer_(AllocateBuffer(pool, (4 + values_per_block_) *
sizeof(T))),
+ bit_writer_(bits_buffer_->mutable_data(),
static_cast<int>(bits_buffer_->size())),
+ deltas_(std::vector<T>(values_per_block_)) {}
+
+ std::shared_ptr<Buffer> FlushValues() override;
+
+ int64_t EstimatedDataEncodedSize() override { return 4 * sizeof(T) +
sink_.length(); }
Review Comment:
Removed the header size approximation. We could estimate it by actually
constricting it but I'm not sure such precision is needed.
--
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]