morrySnow commented on code in PR #35162:
URL: https://github.com/apache/doris/pull/35162#discussion_r1611406226
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/implementation/AggregateStrategies.java:
##########
@@ -306,6 +317,46 @@ && couldConvertToMulti(agg))
);
}
+ /*
+ * select 66 from baseall_dup; could use pushAggOp=COUNT to not scan real
data.
+ */
+ private LogicalProject<? extends Plan> pushDownCountWithoutSlotRef(
+ LogicalProject<? extends Plan> project,
+ LogicalOlapScan logicalScan,
+ CascadesContext cascadesContext) {
+ final LogicalProject<? extends Plan> canNotPush = project;
+ if (!enablePushDownNoGroupAgg()) {
+ return canNotPush;
+ }
+ if (logicalScan != null) {
+ KeysType keysType = logicalScan.getTable().getKeysType();
+ if (keysType != KeysType.DUP_KEYS) {
+ return canNotPush;
+ }
+ }
+ List<Expression> projectExpr = new ArrayList<>();
+ for (Expression p : project.getProjects()) {
+ projectExpr.addAll(Project.collectExpressions(p));
+ }
+ boolean noSlotRef = true;
+ for (Expression expr : projectExpr) {
+ if (expr instanceof SlotReference) {
+ noSlotRef = false;
+ break;
+ }
+ }
+ if (!noSlotRef) {
+ return canNotPush;
+ }
Review Comment:
```java
for (Expression e : project.getProjects()) {
if (e.anyMatch(SlotReference.class::isInstance)) {
return canNotPush;
}
}
```
btw, could not push down, if contains Nondeterministic expression, such as
UUID()
--
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]