Fix const aggregate expr with rollup wrong result
This commit is contained in:
@ -553,7 +553,8 @@ ObAggregateProcessor::ObAggregateProcessor(ObEvalCtx &eval_ctx,
|
||||
tmp_store_row_(nullptr),
|
||||
io_event_observer_(nullptr),
|
||||
removal_info_(),
|
||||
support_fast_single_row_agg_(false)
|
||||
support_fast_single_row_agg_(false),
|
||||
op_eval_infos_(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@ -1180,6 +1181,8 @@ int ObAggregateProcessor::collect_result_batch(const ObIArray<ObExpr *> &group_e
|
||||
} // end for
|
||||
aggr_info.expr_->get_eval_info(eval_ctx_).projected_ = true;
|
||||
}
|
||||
// clear operator evaluated flags to recalc expr after rollup set_null
|
||||
clear_op_evaluated_flag();
|
||||
// project group expr result
|
||||
for (int64_t loop_idx = 0; OB_SUCC(ret) && loop_idx < loop_cnt; loop_idx++) {
|
||||
guard.set_batch_idx(output_brs.size_ + loop_idx);
|
||||
|
||||
@ -655,6 +655,10 @@ public:
|
||||
{
|
||||
io_event_observer_ = observer;
|
||||
}
|
||||
inline void set_op_eval_infos(ObIArray<ObEvalInfo *> *eval_infos)
|
||||
{
|
||||
op_eval_infos_ = eval_infos;
|
||||
}
|
||||
inline ObIArray<ObAggrInfo> &get_aggr_infos() { return aggr_infos_; }
|
||||
int single_row_agg(GroupRow &group_row, ObEvalCtx &eval_ctx);
|
||||
int single_row_agg_batch(GroupRow **group_rows, ObEvalCtx &eval_ctx, const int64_t batch_size, const ObBitVector *skip);
|
||||
@ -840,6 +844,15 @@ private:
|
||||
GroupConcatExtraResult *&extra,
|
||||
ObDatum &concat_result);
|
||||
|
||||
OB_INLINE void clear_op_evaluated_flag()
|
||||
{
|
||||
if (OB_NOT_NULL(op_eval_infos_)) {
|
||||
for (int i = 0; i < op_eval_infos_->count(); i++) {
|
||||
op_eval_infos_->at(i)->clear_evaluated_flag();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// HyperLogLogCount-related functions
|
||||
int llc_init(AggrCell &aggr_cell);
|
||||
int llc_init_empty(ObExpr &expr, ObEvalCtx &eval_ctx);
|
||||
@ -920,6 +933,7 @@ private:
|
||||
ObIOEventObserver *io_event_observer_;
|
||||
RemovalInfo removal_info_;
|
||||
bool support_fast_single_row_agg_;
|
||||
ObIArray<ObEvalInfo *> *op_eval_infos_;
|
||||
};
|
||||
|
||||
struct ObAggregateCalcFunc
|
||||
|
||||
@ -242,6 +242,7 @@ int ObMergeGroupByOp::init()
|
||||
for (int64_t i = 0; !has_dup_group_expr_ && i < MY_SPEC.is_duplicate_rollup_expr_.count(); ++i) {
|
||||
has_dup_group_expr_ = MY_SPEC.is_duplicate_rollup_expr_.at(i);
|
||||
}
|
||||
aggr_processor_.set_op_eval_infos(&eval_infos_);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -737,7 +738,6 @@ int ObMergeGroupByOp::inner_get_next_row()
|
||||
}
|
||||
}
|
||||
}
|
||||
clear_evaluated_flag();
|
||||
LOG_TRACE("after inner_get_next_row", "aggr_hold_size",
|
||||
aggr_processor_.get_aggr_hold_size(), "aggr_used_size",
|
||||
aggr_processor_.get_aggr_used_size());
|
||||
@ -976,7 +976,6 @@ int ObMergeGroupByOp::inner_get_next_batch(const int64_t max_row_cnt)
|
||||
}
|
||||
}
|
||||
|
||||
clear_evaluated_flag();
|
||||
LOG_DEBUG("after inner_get_next_batch", "aggr_hold_size",
|
||||
aggr_processor_.get_aggr_hold_size(), "aggr_used_size",
|
||||
aggr_processor_.get_aggr_used_size(), K(output_batch_cnt), K(ret));
|
||||
|
||||
Reference in New Issue
Block a user