This is an automated email from the ASF dual-hosted git repository.
morrySnow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 84f8107d878 [chore](window function) remove useless cast in
WindowFunctionChecker (#63284)
84f8107d878 is described below
commit 84f8107d878dd0ee3e2f2aa2227e5f91317d1b7c
Author: morrySnow <[email protected]>
AuthorDate: Mon May 18 16:05:42 2026 +0800
[chore](window function) remove useless cast in WindowFunctionChecker
(#63284)
---
.../rules/analysis/WindowFunctionChecker.java | 28 ++++------------------
.../CheckAndStandardizeWindowFunctionAndFrame.java | 5 ++--
2 files changed, 6 insertions(+), 27 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/WindowFunctionChecker.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/WindowFunctionChecker.java
index cbc5061eacc..1a8cc394adb 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/WindowFunctionChecker.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/WindowFunctionChecker.java
@@ -41,10 +41,8 @@ import
org.apache.doris.nereids.trees.expressions.functions.window.RowNumber;
import org.apache.doris.nereids.trees.expressions.literal.BooleanLiteral;
import org.apache.doris.nereids.trees.expressions.literal.Literal;
import
org.apache.doris.nereids.trees.expressions.visitor.DefaultExpressionVisitor;
-import org.apache.doris.nereids.util.TypeCoercionUtils;
import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableList;
import java.util.List;
import java.util.Optional;
@@ -85,13 +83,11 @@ public class WindowFunctionChecker extends
DefaultExpressionVisitor<Expression,
/**
* step 2: check windowFunction in window
*/
- public Expression checkWindowFunction() {
- // todo: visitNtile()
-
+ public void checkWindowFunction() {
// in checkWindowFrameBeforeFunc() we have confirmed that both left
and right boundary are set as long as
// windowFrame exists, therefore in all following visitXXX functions
we don't need to check whether the right
// boundary is null.
- return windowExpression.accept(this, null);
+ windowExpression.accept(this, null);
}
/**
@@ -246,20 +242,12 @@ public class WindowFunctionChecker extends
DefaultExpressionVisitor<Expression,
throw new AnalysisException("Lag must have three parameters");
}
- Expression column = lag.child(0);
Expression offset = lag.getOffset();
- Expression defaultValue = lag.getDefaultValue();
WindowFrame requiredFrame = new WindowFrame(FrameUnitsType.ROWS,
FrameBoundary.newPrecedingBoundary(),
FrameBoundary.newPrecedingBoundary(offset));
windowExpression = windowExpression.withWindowFrame(requiredFrame);
- // check if the class of lag's column matches defaultValue, and cast it
- if (!TypeCoercionUtils.implicitCast(column.getDataType(),
defaultValue.getDataType()).isPresent()) {
- throw new AnalysisException("DefaultValue's Datatype of LAG()
cannot match its relevant column. The column "
- + "type is " + column.getDataType() + ", but the defaultValue
type is " + defaultValue.getDataType());
- }
- return lag.withChildren(ImmutableList.of(column, offset,
- TypeCoercionUtils.castIfNotMatchType(defaultValue,
column.getDataType())));
+ return lag;
}
/**
@@ -275,20 +263,12 @@ public class WindowFunctionChecker extends
DefaultExpressionVisitor<Expression,
throw new AnalysisException("Lead must have three parameters");
}
- Expression column = lead.child(0);
Expression offset = lead.getOffset();
- Expression defaultValue = lead.getDefaultValue();
WindowFrame requiredFrame = new WindowFrame(FrameUnitsType.ROWS,
FrameBoundary.newPrecedingBoundary(),
FrameBoundary.newFollowingBoundary(offset));
windowExpression = windowExpression.withWindowFrame(requiredFrame);
- // check if the class of lag's column matches defaultValue, and cast it
- if (!TypeCoercionUtils.implicitCast(column.getDataType(),
defaultValue.getDataType()).isPresent()) {
- throw new AnalysisException("DefaultValue's Datatype of LEAD()
can't match its relevant column. The column "
- + "type is " + column.getDataType() + ", but the defaultValue
type is " + defaultValue.getDataType());
- }
- return lead.withChildren(ImmutableList.of(column, offset,
- TypeCoercionUtils.castIfNotMatchType(defaultValue,
column.getDataType())));
+ return lead;
}
/**
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/CheckAndStandardizeWindowFunctionAndFrame.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/CheckAndStandardizeWindowFunctionAndFrame.java
index 6beb9df9c39..7ee94ffad06 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/CheckAndStandardizeWindowFunctionAndFrame.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/CheckAndStandardizeWindowFunctionAndFrame.java
@@ -39,12 +39,11 @@ public class CheckAndStandardizeWindowFunctionAndFrame
extends OneRewriteRuleFac
@Override
public Rule build() {
return RuleType.CHECK_AND_STANDARDIZE_WINDOW_FUNCTION_AND_FRAME.build(
-
logicalWindow().whenNot(LogicalWindow::isChecked).then(logicalWindow ->
- checkAndStandardize(logicalWindow))
+
logicalWindow().whenNot(LogicalWindow::isChecked).then(this::checkAndStandardize)
);
}
- private LogicalWindow checkAndStandardize(LogicalWindow<Plan>
logicalWindow) {
+ private LogicalWindow<?> checkAndStandardize(LogicalWindow<Plan>
logicalWindow) {
List<NamedExpression> newOutputExpressions =
logicalWindow.getWindowExpressions().stream()
.map(expr -> {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]