morrySnow commented on code in PR #26899:
URL: https://github.com/apache/doris/pull/26899#discussion_r1396690978
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/ExtractAndNormalizeWindowExpression.java:
##########
@@ -44,7 +46,22 @@ public class ExtractAndNormalizeWindowExpression extends
OneRewriteRuleFactory i
@Override
public Rule build() {
return logicalProject().when(project ->
containsWindowExpression(project.getProjects())).then(project -> {
- List<NamedExpression> outputs = project.getProjects();
+ List<NamedExpression> outputs =
+
ExpressionUtils.rewriteDownShortCircuit(project.getProjects(), output -> {
+ if (output instanceof WindowExpression) {
+ // remove literal partition by and order by keys
+ WindowExpression windowExpression =
(WindowExpression) output;
+ return windowExpression.withPartitionKeysOrderKeys(
+
windowExpression.getPartitionKeys().stream()
+ .filter(expression -> !(expression
instanceof Literal))
Review Comment:
use `expression.isConstant()`
--
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]