github-actions[bot] commented on code in PR #69625:
URL: https://github.com/apache/doris/pull/69625#discussion_r4375522650
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java:
##########
@@ -3069,7 +3071,18 @@ private void addConjunctsToPlanNode(PhysicalFilter<?
extends Plan> filter,
PlanTranslatorContext context) {
for (Expression conjunct : filter.getConjuncts()) {
for (Expression singleConjunct :
ExpressionUtils.extractConjunctionToSet(conjunct)) {
-
planNode.addConjunct(ExpressionTranslator.translate(singleConjunct, context));
+ Expr translated =
ExpressionTranslator.translate(singleConjunct, context);
+ if (planNode instanceof LanceScanNode
+ && ((LanceScanNode)
planNode).isScalarIndexAutoSelectionEnabled()
+ && filter.child().getStats() != null &&
filter.child().getStats().getRowCount() > 0) {
+ double inputRows = filter.child().getStats().getRowCount();
+ // Estimation may normalize column statistics. Keep the
optimizer's input
+ // unchanged, and attach only an advisory cost to the
translated predicate.
+ double outputRows = new FilterEstimation().estimate(
+ singleConjunct, new
Statistics(filter.child().getStats())).getRowCount();
Review Comment:
[P2] Keep advisory selectivity failures from aborting Lance scans
For an analyzed Lance DOUBLE column `d` with finite min/max statistics, this
valid reduced plan reaches the new estimator with the default switch enabled:
```text
PhysicalFilter(d IN (1.0, 2.0, 3.0, CAST('Infinity' AS DOUBLE)))
PhysicalFileScan(Lance table)
```
`ExpressionEstimation.visitLiteral` gives the Infinity literal equal
infinite endpoints, then `FilterEstimation.updateInPredicateColumnStatistics`
checks `abs(max - min) < 1e-6`; Infinity minus Infinity is NaN, so it throws
`literal's min/max doesn't equal`. Previously `StatsCalculator.estimate` caught
this optional statistics failure and kept the child statistics, and the
nonfinite IN stayed a Doris residual. Retrying estimation here without that
boundary makes the query fail during translation, even when the table has no
scalar index. Leave selectivity unknown when advisory estimation fails and add
a regression covering this case.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]