wgtmac commented on code in PR #14341: URL: https://github.com/apache/arrow/pull/14341#discussion_r1256835289
########## cpp/src/parquet/encoding.cc: ########## @@ -3037,14 +3058,237 @@ class RleBooleanDecoder : public DecoderImpl, virtual public BooleanDecoder { // ---------------------------------------------------------------------- // DELTA_BYTE_ARRAY -class DeltaByteArrayDecoder : public DecoderImpl, - virtual public TypedDecoder<ByteArrayType> { +/// Delta Byte Array encoding also known as incremental encoding or front compression: +/// for each element in a sequence of strings, store the prefix length of the previous +/// entry plus the suffix. +/// +/// This is stored as a sequence of delta-encoded prefix lengths (DELTA_BINARY_PACKED), +/// followed by the suffixes encoded as delta length byte arrays +/// (DELTA_LENGTH_BYTE_ARRAY). + +// ---------------------------------------------------------------------- +// DeltaByteArrayEncoder + +template <typename DType> +class DeltaByteArrayEncoder : public EncoderImpl, virtual public TypedEncoder<DType> { + static constexpr std::string_view kEmpty = ""; + public: - explicit DeltaByteArrayDecoder(const ColumnDescriptor* descr, + using T = typename DType::c_type; + + explicit DeltaByteArrayEncoder(const ColumnDescriptor* descr, MemoryPool* pool = ::arrow::default_memory_pool()) + : EncoderImpl(descr, Encoding::DELTA_BYTE_ARRAY, pool), + sink_(pool), + prefix_length_encoder_(descr, pool), Review Comment: Sorry for confusion, I think we should only pass `descr` to suffix_encoder_ as it applies to ByteArrayType. But prefix_length_encoder_ is only for integer types, passing descr to it may introduce weird behavior. What about keep passing nullptr for now? Though internally the DeltaBitPackEncoder does not use the type, I am just afraid it will break in the future. WDYT? cc @mapleFU @pitrou -- 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: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org