fix encoding when rows exceeds uint16_MAX

This commit is contained in:
obdev
2022-11-23 08:07:04 +00:00
committed by wangzelin.wzl
parent b0bb9e7653
commit dc95d872c2
2 changed files with 4 additions and 3 deletions

View File

@ -576,7 +576,7 @@ int ObMicroBlockEncoder::build_block(char *&buf, int64_t &size)
if (OB_FAIL(set_row_data_pos(fix_data_size))) {
LOG_WARN("set row data position failed", K(ret));
} else {
header_->var_column_count_ = static_cast<int16_t>(var_data_encoders_.count());
header_->var_column_count_ = static_cast<uint16_t>(var_data_encoders_.count());
}
}
@ -613,7 +613,7 @@ int ObMicroBlockEncoder::build_block(char *&buf, int64_t &size)
// <5> fill header
if (OB_SUCC(ret)) {
header_->row_count_ = static_cast<int16_t>(datum_rows_.count());
header_->row_count_ = static_cast<uint32_t>(datum_rows_.count());
header_->encoding_has_out_row_column_ = has_out_row_column_;
const int64_t header_size = header_->header_size_;

View File

@ -38,7 +38,8 @@ public:
static const int64_t DEFAULT_ESTIMATE_REAL_SIZE_PCT = 150;
// maximum row count is restricted to 4 bytes in MicroBlockHeader
static const int64_t MAX_MICRO_BLOCK_ROW_CNT = UINT32_MAX;
// But all_col_datums_ is restricted to 64K, so we limit maximum row count to uint16_max
static const int64_t MAX_MICRO_BLOCK_ROW_CNT = UINT16_MAX;
// Unlike ObMicroBlockWriter, ObMicroBlockEncoder internally uses ObRowWriter and ObIColumnEncoder
// to form row and column data. Both ObRowWriter and ObIColumnEncoder check buffer capacity by
// calling ObBufferWriter::advance_zero. If buffer size is not enough, they return failure.