Revise qual selectivity
This commit is contained in:
@ -610,6 +610,8 @@ int ObOptSelectivity::calculate_selectivity(const OptTableMetas &table_metas,
|
|||||||
// do nothing
|
// do nothing
|
||||||
} else if (OB_FAIL(estimator->get_sel(table_metas, ctx, single_sel, all_predicate_sel))) {
|
} else if (OB_FAIL(estimator->get_sel(table_metas, ctx, single_sel, all_predicate_sel))) {
|
||||||
LOG_WARN("failed to calculate one qual selectivity", KPC(estimator), K(qual), K(ret));
|
LOG_WARN("failed to calculate one qual selectivity", KPC(estimator), K(qual), K(ret));
|
||||||
|
} else if (FALSE_IT(single_sel = revise_between_0_1(single_sel))) {
|
||||||
|
// never reach
|
||||||
} else if (OB_FAIL(add_var_to_array_no_dup(all_predicate_sel, ObExprSelPair(qual, single_sel)))) {
|
} else if (OB_FAIL(add_var_to_array_no_dup(all_predicate_sel, ObExprSelPair(qual, single_sel)))) {
|
||||||
LOG_WARN("fail ed to add selectivity to plan", K(ret), K(qual), K(selectivity));
|
LOG_WARN("fail ed to add selectivity to plan", K(ret), K(qual), K(selectivity));
|
||||||
} else {
|
} else {
|
||||||
@ -630,7 +632,7 @@ int ObOptSelectivity::calculate_selectivity(const OptTableMetas &table_metas,
|
|||||||
} else if (OB_FAIL(estimator->get_sel(table_metas, ctx, tmp_selectivity, all_predicate_sel))) {
|
} else if (OB_FAIL(estimator->get_sel(table_metas, ctx, tmp_selectivity, all_predicate_sel))) {
|
||||||
LOG_WARN("failed to get sel", K(ret), KPC(estimator));
|
LOG_WARN("failed to get sel", K(ret), KPC(estimator));
|
||||||
} else {
|
} else {
|
||||||
selectivities.at(i) = tmp_selectivity;
|
selectivities.at(i) = revise_between_0_1(tmp_selectivity);
|
||||||
if (ObSelEstType::RANGE == estimator->get_type()) {
|
if (ObSelEstType::RANGE == estimator->get_type()) {
|
||||||
ObRangeSelEstimator *range_estimator = static_cast<ObRangeSelEstimator *>(estimator);
|
ObRangeSelEstimator *range_estimator = static_cast<ObRangeSelEstimator *>(estimator);
|
||||||
if (OB_FAIL(add_var_to_array_no_dup(all_predicate_sel,
|
if (OB_FAIL(add_var_to_array_no_dup(all_predicate_sel,
|
||||||
|
@ -1725,7 +1725,7 @@ int ObBoolOpSelEstimator::get_sel(const OptTableMetas &table_metas,
|
|||||||
} else {
|
} else {
|
||||||
// not op.
|
// not op.
|
||||||
// if can calculate null_sel, sel = 1.0 - null_sel - op_sel
|
// if can calculate null_sel, sel = 1.0 - null_sel - op_sel
|
||||||
selectivity = 1.0 - null_sel - tmp_selectivity;
|
selectivity = ObOptSelectivity::revise_between_0_1(1.0 - null_sel - tmp_selectivity);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// for other condition, it's is too hard to consider null_sel, so ignore it.
|
// for other condition, it's is too hard to consider null_sel, so ignore it.
|
||||||
|
Reference in New Issue
Block a user