diff --git a/be/src/formats/parquet/encoding_plain.h b/be/src/formats/parquet/encoding_plain.h index 5682bff9914e05..9e55bd4e868b8d 100644 --- a/be/src/formats/parquet/encoding_plain.h +++ b/be/src/formats/parquet/encoding_plain.h @@ -15,6 +15,7 @@ #pragma once #include "column/column.h" +#include "column/column_helper.h" #include "common/status.h" #include "formats/parquet/encoding.h" #include "gutil/strings/substitute.h" @@ -173,11 +174,13 @@ class PlainDecoder final : public Decoder { slices.reserve(count); size_t num_decoded = 0; + size_t byte_size = 0; while (num_decoded < count && _offset < _data.size) { uint32_t length = decode_fixed32_le(reinterpret_cast(_data.data) + _offset); _offset += sizeof(int32_t); slices.emplace_back(_data.data + _offset, length); _offset += length; + byte_size += length; num_decoded++; } // never happend @@ -185,6 +188,7 @@ class PlainDecoder final : public Decoder { return Status::InternalError(strings::Substitute( "going to read out-of-bounds data, offset=$0,count=$1,size=$2", _offset, count, _data.size)); } + ColumnHelper::get_column_by_type(dst)->reserve(count, byte_size); auto ret = dst->append_strings(slices); if (UNLIKELY(!ret)) { return Status::InternalError("PlainDecoder append strings to column failed");