Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -832,17 +832,24 @@ private Statistics computeFilter(Filter filter) {
Statistics isNullStats = computeGeneratedIsNullStats((LogicalJoin) plan, filter);
if (isNullStats != null) {
// overwrite the stats corrected as above before passing to filter estimation
stats = isNullStats;
Set<Expression> newConjuncts = filter.getConjuncts().stream()
.filter(e -> !(e instanceof IsNull))
.collect(Collectors.toSet());
if (newConjuncts.isEmpty()) {
return stats;
return isNullStats;
} else {
// overwrite the filter by removing is null and remain the others
filter = ((LogicalFilter<?>) filter).withConjunctsAndProps(newConjuncts,
((LogicalFilter<?>) filter).getGroupExpression(),
Optional.of(((LogicalFilter<?>) filter).getLogicalProperties()), plan);
// add update is-null related column stats for other predicate derive
StatisticsBuilder builder = new StatisticsBuilder(stats);
for (Expression expr : isNullStats.columnStatistics().keySet()) {
builder.putColumnStatistics(expr, isNullStats.findColumnStatistics(expr));
}
builder.setRowCount(isNullStats.getRowCount());
stats = builder.build();
stats.enforceValid();
}
}
}
Expand Down