gongxun0928 commented on code in PR #1337: URL: https://github.com/apache/cloudberry/pull/1337#discussion_r2309365883
########## contrib/pax_storage/src/cpp/storage/columns/pax_encoding_non_fixed_column.cc: ########## @@ -61,19 +61,40 @@ void PaxNonFixedEncodingColumn::InitEncoder() { void PaxNonFixedEncodingColumn::InitOffsetStreamCompressor() { Assert(encoder_options_.offsets_encode_type != ColumnEncoding_Kind::ColumnEncoding_Kind_DEF_ENCODED); - offsets_compressor_ = PaxCompressor::CreateBlockCompressor( - encoder_options_.offsets_encode_type); SetOffsetsEncodeType(encoder_options_.offsets_encode_type); SetOffsetsCompressLevel(encoder_options_.offsets_compress_level); + + // Prefer encoder for offsets if encoding type supports it; otherwise use + // compressor + if (encoder_options_.offsets_encode_type == + ColumnEncoding_Kind::ColumnEncoding_Kind_DIRECT_DELTA) { + PaxEncoder::EncodingOption opt = encoder_options_; + opt.column_encode_type = encoder_options_.offsets_encode_type; + // offsets are fixed-width, do not enable non_fixed streaming restriction + offsets_encoder_ = PaxEncoder::CreateStreamingEncoder(opt, false); + } else { + offsets_compressor_ = PaxCompressor::CreateBlockCompressor( Review Comment: For backward compatibility, we no longer use Zstd compression when writing data, but we still need to support reading data that might have been compressed with Zstd in previous versions. will delete it in InitOffsetStreamCompressor -- 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: commits-unsubscr...@cloudberry.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cloudberry.apache.org For additional commands, e-mail: commits-h...@cloudberry.apache.org