Gabriel39 commented on code in PR #69625:
URL: https://github.com/apache/doris/pull/69625#discussion_r4384332975


##########
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:
   Already addressed in a4e757b9a7dea0b114c27988d87951a83f910dc7 when 
scalar-index selection moved from FE estimates to bounded BE runtime costs. The 
extra FE selectivity estimation and its session variable were removed. 
PhysicalPlanTranslator now matches the PR base, so this translation path no 
longer retries FilterEstimation and the existing nonfinite-predicate 
residual/statistics handling is preserved. Closing this outdated thread; the 
latest review also confirms it is fixed.
   



-- 
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]

Reply via email to