morrySnow commented on code in PR #29242:
URL: https://github.com/apache/doris/pull/29242#discussion_r1438268274


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/implementation/AggregateStrategies.java:
##########
@@ -140,6 +143,71 @@ public List<Rule> buildRules() {
                         return pushdownCountOnIndex(agg, project, filter, 
olapScan, ctx.cascadesContext);
                     })
             ),
+            
RuleType.STORAGE_LAYER_AGGREGATE_MINMAX_ON_UNIQUE_WITHOUT_PROJECT.build(
+                logicalAggregate(
+                        logicalFilter(
+                                logicalOlapScan().when(this::isUniqueKeyTable))
+                                .when(filter -> {
+                                    if (filter.getConjuncts().size() != 1) {
+                                        return false;
+                                    }
+                                    Expression childExpr = 
filter.getConjuncts().iterator().next().children().get(0);
+                                    if (childExpr instanceof SlotReference) {
+                                        String exprName = ((SlotReference) 
childExpr).getName();
+                                        return 
"__DORIS_DELETE_SIGN__".equalsIgnoreCase(exprName);
+                                    }
+                                    return false;
+                                })
+                        )
+                        .when(agg -> enablePushDownMinMaxOnUnique())
+                        .when(agg -> agg.getGroupByExpressions().size() == 0)

Review Comment:
   do not use `size() == 0`, use `isEmpty()`



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/implementation/AggregateStrategies.java:
##########
@@ -140,6 +143,71 @@ public List<Rule> buildRules() {
                         return pushdownCountOnIndex(agg, project, filter, 
olapScan, ctx.cascadesContext);
                     })
             ),
+            
RuleType.STORAGE_LAYER_AGGREGATE_MINMAX_ON_UNIQUE_WITHOUT_PROJECT.build(
+                logicalAggregate(
+                        logicalFilter(
+                                logicalOlapScan().when(this::isUniqueKeyTable))
+                                .when(filter -> {
+                                    if (filter.getConjuncts().size() != 1) {
+                                        return false;
+                                    }
+                                    Expression childExpr = 
filter.getConjuncts().iterator().next().children().get(0);
+                                    if (childExpr instanceof SlotReference) {
+                                        String exprName = ((SlotReference) 
childExpr).getName();
+                                        return 
"__DORIS_DELETE_SIGN__".equalsIgnoreCase(exprName);

Review Comment:
   u should use `getColumn` and use inferface on Column to check it is delete 
sign or not.
   ```
   Column#isDeleteSignColumn
   ``` 



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to