[CP] do not generate origin row for no_non_distinct_aggr_ in 3-aggr
This commit is contained in:
committed by
ob-robot
parent
32636e05c4
commit
08373e0dd0
@ -2463,6 +2463,8 @@ int ObHashGroupByOp::load_one_row()
|
|||||||
bool last_group = false;
|
bool last_group = false;
|
||||||
bool insert_group_ht = false;
|
bool insert_group_ht = false;
|
||||||
clear_evaluated_flag();
|
clear_evaluated_flag();
|
||||||
|
bool got_row = false;
|
||||||
|
while (OB_SUCC(ret) && !got_row) {
|
||||||
if (OB_ISNULL(last_child_row_)) {
|
if (OB_ISNULL(last_child_row_)) {
|
||||||
ret = OB_ERR_UNEXPECTED;
|
ret = OB_ERR_UNEXPECTED;
|
||||||
LOG_WARN("last child row not init", K(ret));
|
LOG_WARN("last child row not init", K(ret));
|
||||||
@ -2477,6 +2479,12 @@ int ObHashGroupByOp::load_one_row()
|
|||||||
LOG_WARN("failed to restore last row", K(ret));
|
LOG_WARN("failed to restore last row", K(ret));
|
||||||
} else if (OB_FAIL(by_pass_get_next_permutation(by_pass_nth_group_, last_group, insert_group_ht))) {
|
} else if (OB_FAIL(by_pass_get_next_permutation(by_pass_nth_group_, last_group, insert_group_ht))) {
|
||||||
LOG_WARN("failed to get next permutation row", K(ret));
|
LOG_WARN("failed to get next permutation row", K(ret));
|
||||||
|
} else {
|
||||||
|
if (no_non_distinct_aggr_ && last_group) {
|
||||||
|
got_row = false;
|
||||||
|
} else {
|
||||||
|
got_row = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (FALSE_IT(by_pass_nth_group_ = 0)) {
|
} else if (FALSE_IT(by_pass_nth_group_ = 0)) {
|
||||||
} else if (nullptr != last_child_row_->store_row_
|
} else if (nullptr != last_child_row_->store_row_
|
||||||
@ -2492,6 +2500,12 @@ int ObHashGroupByOp::load_one_row()
|
|||||||
LOG_WARN("check status failed", K(ret));
|
LOG_WARN("check status failed", K(ret));
|
||||||
} else if (OB_FAIL(by_pass_get_next_permutation(by_pass_nth_group_, last_group, insert_group_ht))) {
|
} else if (OB_FAIL(by_pass_get_next_permutation(by_pass_nth_group_, last_group, insert_group_ht))) {
|
||||||
LOG_WARN("failed to get next permutation row", K(ret));
|
LOG_WARN("failed to get next permutation row", K(ret));
|
||||||
|
} else {
|
||||||
|
if (no_non_distinct_aggr_ && last_group) {
|
||||||
|
got_row = false;
|
||||||
|
} else {
|
||||||
|
got_row = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (OB_FAIL(ret) || no_non_distinct_aggr_) {
|
if (OB_FAIL(ret) || no_non_distinct_aggr_) {
|
||||||
} else if (OB_ISNULL(by_pass_group_row_)
|
} else if (OB_ISNULL(by_pass_group_row_)
|
||||||
@ -2505,6 +2519,7 @@ int ObHashGroupByOp::load_one_row()
|
|||||||
LOG_WARN("failed to do single row agg", K(ret));
|
LOG_WARN("failed to do single row agg", K(ret));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2520,7 +2535,9 @@ int ObHashGroupByOp::by_pass_prepare_one_batch(const int64_t batch_size)
|
|||||||
//consume curr batch
|
//consume curr batch
|
||||||
if (OB_FAIL(by_pass_brs_holder_.restore())) {
|
if (OB_FAIL(by_pass_brs_holder_.restore())) {
|
||||||
LOG_WARN("failed to restore child batch", K(ret));
|
LOG_WARN("failed to restore child batch", K(ret));
|
||||||
} else if (OB_FAIL(by_pass_get_next_permutation_batch(by_pass_nth_group_, last_group, by_pass_child_brs_, insert_group_ht))) {
|
} else if (OB_FAIL(by_pass_get_next_permutation_batch(by_pass_nth_group_, last_group,
|
||||||
|
by_pass_child_brs_, brs_,
|
||||||
|
insert_group_ht))) {
|
||||||
LOG_WARN("failed to get next permutation row", K(ret));
|
LOG_WARN("failed to get next permutation row", K(ret));
|
||||||
}
|
}
|
||||||
} else if (FALSE_IT(by_pass_nth_group_ = 0)) {
|
} else if (FALSE_IT(by_pass_nth_group_ = 0)) {
|
||||||
@ -2536,7 +2553,9 @@ int ObHashGroupByOp::by_pass_prepare_one_batch(const int64_t batch_size)
|
|||||||
LOG_WARN("failed to save child batch", K(ret));
|
LOG_WARN("failed to save child batch", K(ret));
|
||||||
} else if (OB_FAIL(try_check_status())) {
|
} else if (OB_FAIL(try_check_status())) {
|
||||||
LOG_WARN("check status failed", K(ret));
|
LOG_WARN("check status failed", K(ret));
|
||||||
} else if (OB_FAIL(by_pass_get_next_permutation_batch(by_pass_nth_group_, last_group, by_pass_child_brs_, insert_group_ht))) {
|
} else if (OB_FAIL(by_pass_get_next_permutation_batch(by_pass_nth_group_, last_group,
|
||||||
|
by_pass_child_brs_, brs_,
|
||||||
|
insert_group_ht))) {
|
||||||
LOG_WARN("failed to get next permutation row", K(ret));
|
LOG_WARN("failed to get next permutation row", K(ret));
|
||||||
}
|
}
|
||||||
if (OB_FAIL(ret) || no_non_distinct_aggr_) {
|
if (OB_FAIL(ret) || no_non_distinct_aggr_) {
|
||||||
@ -2544,22 +2563,18 @@ int ObHashGroupByOp::by_pass_prepare_one_batch(const int64_t batch_size)
|
|||||||
|| by_pass_batch_size_ <= 0) {
|
|| by_pass_batch_size_ <= 0) {
|
||||||
ret = OB_ERR_UNEXPECTED;
|
ret = OB_ERR_UNEXPECTED;
|
||||||
LOG_WARN("by pass group row is not init", K(ret), K(by_pass_batch_size_));
|
LOG_WARN("by pass group row is not init", K(ret), K(by_pass_batch_size_));
|
||||||
} else if (OB_FAIL(aggr_processor_.eval_aggr_param_batch(*by_pass_child_brs_))) {
|
} else if (OB_FAIL(aggr_processor_.eval_aggr_param_batch(brs_))) {
|
||||||
LOG_WARN("fail to eval aggr param batch", K(ret), K(*by_pass_child_brs_));
|
LOG_WARN("fail to eval aggr param batch", K(ret), K(brs_));
|
||||||
} else {
|
} else {
|
||||||
if (OB_FAIL(aggr_processor_.single_row_agg_batch(by_pass_group_batch_, eval_ctx_,
|
if (OB_FAIL(aggr_processor_.single_row_agg_batch(by_pass_group_batch_, eval_ctx_,
|
||||||
by_pass_child_brs_->size_, by_pass_child_brs_->skip_))) {
|
brs_.size_, brs_.skip_))) {
|
||||||
LOG_WARN("failed to single row agg", K(ret));
|
LOG_WARN("failed to single row agg", K(ret));
|
||||||
} else {
|
} else {
|
||||||
int64_t aggr_cnt = by_pass_child_brs_->size_ - by_pass_child_brs_->skip_->accumulate_bit_cnt(by_pass_child_brs_->size_);
|
int64_t aggr_cnt = brs_.size_ - brs_.skip_->accumulate_bit_cnt(brs_.size_);
|
||||||
agged_row_cnt_ += aggr_cnt;
|
agged_row_cnt_ += aggr_cnt;
|
||||||
agged_group_cnt_ += aggr_cnt;
|
agged_group_cnt_ += aggr_cnt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (OB_SUCC(ret)) {
|
|
||||||
brs_.size_ = by_pass_child_brs_->size_;
|
|
||||||
brs_.skip_->deep_copy(*by_pass_child_brs_->skip_, by_pass_child_brs_->size_);
|
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2588,16 +2603,24 @@ int ObHashGroupByOp::by_pass_get_next_permutation(int64_t &nth_group, bool &last
|
|||||||
}
|
}
|
||||||
|
|
||||||
int ObHashGroupByOp::by_pass_get_next_permutation_batch(int64_t &nth_group, bool &last_group,
|
int ObHashGroupByOp::by_pass_get_next_permutation_batch(int64_t &nth_group, bool &last_group,
|
||||||
const ObBatchRows *child_brs, bool &insert_group_ht)
|
const ObBatchRows *child_brs,
|
||||||
|
ObBatchRows &my_brs,
|
||||||
|
bool &insert_group_ht)
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
if (ObThreeStageAggrStage::NONE_STAGE == MY_SPEC.aggr_stage_) {
|
CK (OB_NOT_NULL(child_brs));
|
||||||
|
OX (my_brs.size_ = child_brs->size_);
|
||||||
|
OX (my_brs.skip_->deep_copy(*child_brs->skip_, child_brs->size_));
|
||||||
|
if (OB_FAIL(ret)) {
|
||||||
|
} else if (ObThreeStageAggrStage::NONE_STAGE == MY_SPEC.aggr_stage_) {
|
||||||
last_group = true;
|
last_group = true;
|
||||||
} else if (OB_FAIL(next_duplicate_data_permutation(nth_group, last_group, child_brs, insert_group_ht))) {
|
} else if (OB_FAIL(next_duplicate_data_permutation(nth_group, last_group, child_brs, insert_group_ht))) {
|
||||||
LOG_WARN("failed to get next permutation", K(ret));
|
LOG_WARN("failed to get next permutation", K(ret));
|
||||||
} else {
|
} else {
|
||||||
CK (dup_groupby_exprs_.count() == all_groupby_exprs_.count());
|
CK (dup_groupby_exprs_.count() == all_groupby_exprs_.count());
|
||||||
CK (OB_NOT_NULL(child_brs));
|
if (no_non_distinct_aggr_ && last_group) {
|
||||||
|
my_brs.skip_->set_all(child_brs->size_);
|
||||||
|
} else {
|
||||||
for (int64_t i = 0; OB_SUCC(ret) && i < dup_groupby_exprs_.count(); ++i) {
|
for (int64_t i = 0; OB_SUCC(ret) && i < dup_groupby_exprs_.count(); ++i) {
|
||||||
ObDatum *datum = nullptr;
|
ObDatum *datum = nullptr;
|
||||||
if (nullptr == dup_groupby_exprs_.at(i)) {
|
if (nullptr == dup_groupby_exprs_.at(i)) {
|
||||||
@ -2620,6 +2643,7 @@ int ObHashGroupByOp::by_pass_get_next_permutation_batch(int64_t &nth_group, bool
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -518,7 +518,10 @@ private:
|
|||||||
private:
|
private:
|
||||||
int by_pass_prepare_one_batch(const int64_t batch_size);
|
int by_pass_prepare_one_batch(const int64_t batch_size);
|
||||||
int by_pass_get_next_permutation(int64_t &nth_group, bool &last_group, bool &insert_group_ht);
|
int by_pass_get_next_permutation(int64_t &nth_group, bool &last_group, bool &insert_group_ht);
|
||||||
int by_pass_get_next_permutation_batch(int64_t &nth_group, bool &last_group, const ObBatchRows *child_brs, bool &insert_group_ht);
|
int by_pass_get_next_permutation_batch(int64_t &nth_group, bool &last_group,
|
||||||
|
const ObBatchRows *child_brs,
|
||||||
|
ObBatchRows &my_brs,
|
||||||
|
bool &insert_group_ht);
|
||||||
int init_by_pass_op();
|
int init_by_pass_op();
|
||||||
// Alloc one batch group_row_item at a time
|
// Alloc one batch group_row_item at a time
|
||||||
static const int64_t BATCH_GROUP_ITEM_SIZE = 16;
|
static const int64_t BATCH_GROUP_ITEM_SIZE = 16;
|
||||||
|
|||||||
Reference in New Issue
Block a user