Fix vector 2.0 case and opt temp column store from_vector

This commit is contained in:
hezuojiao
2024-02-08 10:23:00 +00:00
committed by ob-robot
parent 1fd0e862c1
commit d719518631
3 changed files with 13 additions and 7 deletions

View File

@ -171,6 +171,7 @@ int ObTempColumnStore::Iterator::get_next_batch(const ObExprPtrIArray &exprs,
int64_t &read_rows) int64_t &read_rows)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
read_rows = 0;
if (OB_UNLIKELY(exprs.count() != column_store_->get_col_cnt())) { if (OB_UNLIKELY(exprs.count() != column_store_->get_col_cnt())) {
ret = OB_INVALID_ARGUMENT; ret = OB_INVALID_ARGUMENT;
LOG_WARN("column count mismatch", K(ret), K(exprs.count()), K(column_store_->get_col_cnt())); LOG_WARN("column count mismatch", K(ret), K(exprs.count()), K(column_store_->get_col_cnt()));

View File

@ -288,15 +288,18 @@ template<>
inline int ObTempColumnStore::from_vector(ObBitmapNullVectorBase *vec, ObExpr *expr, ObEvalCtx &ctx, inline int ObTempColumnStore::from_vector(ObBitmapNullVectorBase *vec, ObExpr *expr, ObEvalCtx &ctx,
const int64_t start_pos, const int64_t size) const int64_t start_pos, const int64_t size)
{ {
const uint16_t flag = vec->get_flag(); // reuse null vector memory if there is no null data
ObBitVector &nulls = expr->get_nulls(ctx); if (vec->has_null()) {
nulls.reset(size); const uint16_t flag = vec->get_flag();
for (int64_t idx = start_pos; idx < size; ++idx) { ObBitVector &nulls = expr->get_nulls(ctx);
if (vec->is_null(idx)) { nulls.reset(size - start_pos);
nulls.set(idx - start_pos); for (int64_t idx = start_pos; idx < size; ++idx) {
if (vec->is_null(idx)) {
nulls.set(idx - start_pos);
}
} }
vec->from(&nulls, flag);
} }
vec->from(&nulls, flag);
return common::OB_SUCCESS; return common::OB_SUCCESS;
} }

View File

@ -263,6 +263,7 @@ int ObTempRowStore::Iterator::get_next_batch(const ObExprPtrIArray &exprs,
const ObCompactRow **stored_rows) const ObCompactRow **stored_rows)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
read_rows = 0;
if (OB_FAIL(row_store_->init_batch_ctx())) { if (OB_FAIL(row_store_->init_batch_ctx())) {
LOG_WARN("init batch ctx failed", K(ret)); LOG_WARN("init batch ctx failed", K(ret));
} else if (OB_UNLIKELY(NULL == cur_blk_ || !cur_blk_->contain(cur_blk_id_))) { } else if (OB_UNLIKELY(NULL == cur_blk_ || !cur_blk_->contain(cur_blk_id_))) {
@ -340,6 +341,7 @@ int ObTempRowStore::Iterator::get_next_batch(const int64_t max_rows,
int64_t &read_rows, int64_t &read_rows,
const ObCompactRow **stored_rows) { const ObCompactRow **stored_rows) {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
read_rows = 0;
if (OB_ISNULL(stored_rows)) { if (OB_ISNULL(stored_rows)) {
ret = OB_INVALID_ARGUMENT; ret = OB_INVALID_ARGUMENT;
LOG_WARN("stored rows is null", K(ret)); LOG_WARN("stored rows is null", K(ret));