## Proposed changes pick #39592 Issue Number: close #xxx <!--Describe your changes.-->
This commit is contained in:
@ -334,14 +334,28 @@ public class FilterEstimation extends ExpressionVisitor<Statistics, EstimationCo
|
||||
ColumnStatistic statsForRight,
|
||||
EstimationContext context) {
|
||||
double selectivity;
|
||||
double ndv = statsForLeft.ndv;
|
||||
double val = statsForRight.maxValue;
|
||||
if (val > statsForLeft.maxValue || val < statsForLeft.minValue) {
|
||||
selectivity = 0.0;
|
||||
if (statsForLeft.isUnKnown) {
|
||||
selectivity = DEFAULT_INEQUALITY_COEFFICIENT;
|
||||
} else {
|
||||
selectivity = StatsMathUtil.minNonNaN(1.0, 1.0 / ndv);
|
||||
double ndv = statsForLeft.ndv;
|
||||
if (statsForRight.isUnKnown) {
|
||||
if (ndv >= 1.0) {
|
||||
selectivity = 1.0 / ndv;
|
||||
} else {
|
||||
selectivity = DEFAULT_INEQUALITY_COEFFICIENT;
|
||||
}
|
||||
} else {
|
||||
double val = statsForRight.maxValue;
|
||||
if (val > statsForLeft.maxValue || val < statsForLeft.minValue) {
|
||||
selectivity = 0.0;
|
||||
} else if (ndv >= 1.0) {
|
||||
selectivity = StatsMathUtil.minNonNaN(1.0, 1.0 / ndv);
|
||||
} else {
|
||||
selectivity = DEFAULT_INEQUALITY_COEFFICIENT;
|
||||
}
|
||||
selectivity = getNotNullSelectivity(statsForLeft, selectivity);
|
||||
}
|
||||
}
|
||||
selectivity = getNotNullSelectivity(statsForLeft, selectivity);
|
||||
Statistics equalStats = context.statistics.withSel(selectivity);
|
||||
Expression left = cp.left();
|
||||
equalStats.addColumnStats(left, statsForRight);
|
||||
|
||||
Reference in New Issue
Block a user