Fix not fill values to output_exprs in agg pushdown
This commit is contained in:
@ -152,12 +152,12 @@ int ObAggRow::init(const ObTableAccessParam ¶m, const int64_t batch_size)
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < param.output_exprs_->count(); ++i) {
|
||||
// mysql compatibility, select a,count(a), output the first value of a
|
||||
// from 4.3, this non-standard scalar group by will not pushdown to storage
|
||||
// so just ignore the output_exprs_
|
||||
// so we can just set an determined value to output_exprs_ as it's never be used
|
||||
if (T_PSEUDO_GROUP_ID == param.output_exprs_->at(i)->type_) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("Unexpected group idx expr", K(ret));
|
||||
} /* else if (nullptr == param.output_sel_mask_ || param.output_sel_mask_->at(i)) {
|
||||
need_access_data_ = true;
|
||||
} else if (nullptr == param.output_sel_mask_ || param.output_sel_mask_->at(i)) {
|
||||
ObAggCell *cell = nullptr;
|
||||
int32_t col_offset = param.iter_param_.out_cols_project_->at(i);
|
||||
int32_t col_index = param.iter_param_.read_info_->get_columns_index().at(col_offset);
|
||||
const share::schema::ObColumnParam *col_param = out_cols_param->at(col_offset);
|
||||
@ -165,8 +165,14 @@ int ObAggRow::init(const ObTableAccessParam ¶m, const int64_t batch_size)
|
||||
ObAggCellBasicInfo basic_info(col_offset, col_index, col_param, expr, batch_size);
|
||||
if (OB_FAIL(agg_cell_factory_.alloc_cell(basic_info, agg_cells_))) {
|
||||
LOG_WARN("Failed to alloc agg cell", K(ret), K(i));
|
||||
} else if (FALSE_IT(cell = agg_cells_.at(agg_cells_.count() - 1))) {
|
||||
} else if (OB_UNLIKELY(PD_FIRST_ROW != cell->get_type())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("Unexpected agg type", K(ret), KPC(cell));
|
||||
} else {
|
||||
static_cast<ObFirstRowAggCell*>(cell)->set_determined_value();
|
||||
}
|
||||
} */
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
has_lob_column_out_ = false;
|
||||
|
@ -2375,6 +2375,7 @@ int ObSumAggCell::collect_result_to_decimal_int(
|
||||
|
||||
ObFirstRowAggCell::ObFirstRowAggCell(const ObAggCellBasicInfo &basic_info, common::ObIAllocator &allocator)
|
||||
: ObAggCell(basic_info, allocator),
|
||||
is_determined_value_(false),
|
||||
aggregated_flag_cnt_(0),
|
||||
aggregated_flag_buf_(),
|
||||
datum_allocator_("ObStorageAgg", OB_MALLOC_NORMAL_BLOCK_SIZE, MTL_ID())
|
||||
@ -2384,6 +2385,7 @@ ObFirstRowAggCell::ObFirstRowAggCell(const ObAggCellBasicInfo &basic_info, commo
|
||||
|
||||
void ObFirstRowAggCell::reset()
|
||||
{
|
||||
is_determined_value_ = false;
|
||||
aggregated_flag_cnt_ = 0;
|
||||
free_group_by_buf(allocator_, aggregated_flag_buf_);
|
||||
if (nullptr != agg_datum_buf_) {
|
||||
@ -2400,6 +2402,9 @@ void ObFirstRowAggCell::reuse()
|
||||
ObAggCell::reuse();
|
||||
aggregated_flag_cnt_ = 0;
|
||||
datum_allocator_.reuse();
|
||||
if (is_determined_value_) {
|
||||
set_determined_value();
|
||||
}
|
||||
}
|
||||
|
||||
void ObFirstRowAggCell::clear_group_by_info()
|
||||
|
@ -556,8 +556,17 @@ public:
|
||||
virtual bool finished() const override { return aggregated_; }
|
||||
virtual int reserve_group_by_buf(const int64_t size) override;
|
||||
virtual int output_extra_group_by_result(const int64_t start, const int64_t count) override;
|
||||
OB_INLINE void set_determined_value()
|
||||
{
|
||||
is_determined_value_ = true;
|
||||
result_datum_.reuse();
|
||||
result_datum_.set_null();
|
||||
aggregated_ = true;
|
||||
}
|
||||
INHERIT_TO_STRING_KV("ObAggCell", ObAggCell, K_(is_determined_value), K_(aggregated_flag_cnt));
|
||||
private:
|
||||
void clear_group_by_info();
|
||||
bool is_determined_value_;
|
||||
int64_t aggregated_flag_cnt_;
|
||||
ObGroupByExtendableBuf<bool> *aggregated_flag_buf_;
|
||||
common::ObArenaAllocator datum_allocator_;
|
||||
|
@ -493,13 +493,10 @@ int ObCOSSTableRowScanner::construct_cg_agg_iter_params(
|
||||
}
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < access_col_cnt; ++i) {
|
||||
exprs.reuse();
|
||||
// mysql compatibility, select a,count(a), output the first value of a
|
||||
// from 4.3, this non-standard scalar group by will not pushdown to storage
|
||||
// so just ignore the output_exprs_
|
||||
// if (nullptr != row_param.output_sel_mask_ && !row_param.output_sel_mask_->at(i)) {
|
||||
// } else if (OB_FAIL(exprs.push_back(row_param.output_exprs_->at(i)))) {
|
||||
// LOG_WARN("Fail to push back", K(ret), K(i));
|
||||
// }
|
||||
if (nullptr != row_param.output_sel_mask_ && !row_param.output_sel_mask_->at(i)) {
|
||||
} else if (OB_FAIL(exprs.push_back(row_param.output_exprs_->at(i)))) {
|
||||
LOG_WARN("Fail to push back", K(ret), K(i));
|
||||
}
|
||||
const int32_t out_col_offset = row_param.out_cols_project_->at(i);
|
||||
const uint32_t cg_idx = access_cgs->at(out_col_offset);
|
||||
for (int64_t j = 0; OB_SUCC(ret) && j < row_param.agg_cols_project_->count(); ++j) {
|
||||
|
Reference in New Issue
Block a user