You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/11/17 13:48:57 UTC
[GitHub] [doris] 924060929 opened a new pull request, #14380: [Enhancement](Nereids) Support find AggregateFunction by signature and support explain plan
924060929 opened a new pull request, #14380:
URL: https://github.com/apache/doris/pull/14380
# Proposed changes
Issue Number: close #xxx
## Problem summary
Describe your changes.
## Checklist(Required)
1. Does it affect the original behavior:
- [ ] Yes
- [ ] No
- [ ] I don't know
2. Has unit tests been added:
- [ ] Yes
- [ ] No
- [ ] No Need
3. Has document been added or modified:
- [ ] Yes
- [ ] No
- [ ] No Need
4. Does it need to update dependencies:
- [ ] Yes
- [ ] No
5. Are there any changes that cannot be rolled back:
- [ ] Yes (If Yes, please explain WHY)
- [ ] No
## Further comments
If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
--
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-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] 924060929 commented on a diff in pull request #14380: [Enhancement](Nereids) Refactor AggregateFunction and support explain plan
Posted by GitBox <gi...@apache.org>.
924060929 commented on code in PR #14380:
URL: https://github.com/apache/doris/pull/14380#discussion_r1026294286
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Substring.java:
##########
@@ -66,8 +66,9 @@ public Substring(Expression arg0, Expression arg1, Expression arg2) {
}
@Override
- protected FunctionSignature computeSignature(FunctionSignature signature) {
- Optional<Expression> length = getLength();
+ protected FunctionSignature computeSignature(FunctionSignature signature, List<Expression> arguments) {
+ Optional<Expression> length = arguments.size() == 2
Review Comment:
my fault
--
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-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] 924060929 commented on a diff in pull request #14380: [Enhancement](Nereids) Refactor AggregateFunction and support explain plan
Posted by GitBox <gi...@apache.org>.
924060929 commented on code in PR #14380:
URL: https://github.com/apache/doris/pull/14380#discussion_r1026273470
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/AggregateFunction.java:
##########
@@ -183,6 +183,30 @@ public AggregateFunction(FunctionName fnName, List<Type> argTypes,
returnsNonNullOnEmpty = false;
}
+ public AggregateFunction(FunctionName fnName, List<Type> argTypes,
+ Type retType, Type intermediateType, boolean hasVarArgs,
+ URI location, String updateFnSymbol, String initFnSymbol,
+ String serializeFnSymbol, String mergeFnSymbol, String getValueFnSymbol,
+ String removeFnSymbol, String finalizeFnSymbol, boolean ignoresDistinct,
+ boolean isAnalyticFn, boolean returnsNonNullOnEmpty, TFunctionBinaryType binaryType,
+ boolean userVisible, boolean vectorized, NullableMode nullableMode) {
+ // only `count` is always not nullable, other aggregate function is always nullable
+ super(0, fnName, argTypes, retType, hasVarArgs, binaryType, userVisible, vectorized, nullableMode);
+ setLocation(location);
+ this.intermediateType = (intermediateType.equals(retType)) ? null : intermediateType;
+ this.updateFnSymbol = updateFnSymbol;
+ this.initFnSymbol = initFnSymbol;
+ this.serializeFnSymbol = serializeFnSymbol;
+ this.mergeFnSymbol = mergeFnSymbol;
+ this.getValueFnSymbol = getValueFnSymbol;
+ this.removeFnSymbol = removeFnSymbol;
+ this.finalizeFnSymbol = finalizeFnSymbol;
Review Comment:
thrift message has some required field, so we should set to it.
In nereids, this fields usually are null or empty string, we set this fields in ExpressionTranslator.visitAggregateFunction()
--
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-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] 924060929 commented on a diff in pull request #14380: [Enhancement](Nereids) Refactor AggregateFunction and support explain plan
Posted by GitBox <gi...@apache.org>.
924060929 commented on code in PR #14380:
URL: https://github.com/apache/doris/pull/14380#discussion_r1026273470
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/AggregateFunction.java:
##########
@@ -183,6 +183,30 @@ public AggregateFunction(FunctionName fnName, List<Type> argTypes,
returnsNonNullOnEmpty = false;
}
+ public AggregateFunction(FunctionName fnName, List<Type> argTypes,
+ Type retType, Type intermediateType, boolean hasVarArgs,
+ URI location, String updateFnSymbol, String initFnSymbol,
+ String serializeFnSymbol, String mergeFnSymbol, String getValueFnSymbol,
+ String removeFnSymbol, String finalizeFnSymbol, boolean ignoresDistinct,
+ boolean isAnalyticFn, boolean returnsNonNullOnEmpty, TFunctionBinaryType binaryType,
+ boolean userVisible, boolean vectorized, NullableMode nullableMode) {
+ // only `count` is always not nullable, other aggregate function is always nullable
+ super(0, fnName, argTypes, retType, hasVarArgs, binaryType, userVisible, vectorized, nullableMode);
+ setLocation(location);
+ this.intermediateType = (intermediateType.equals(retType)) ? null : intermediateType;
+ this.updateFnSymbol = updateFnSymbol;
+ this.initFnSymbol = initFnSymbol;
+ this.serializeFnSymbol = serializeFnSymbol;
+ this.mergeFnSymbol = mergeFnSymbol;
+ this.getValueFnSymbol = getValueFnSymbol;
+ this.removeFnSymbol = removeFnSymbol;
+ this.finalizeFnSymbol = finalizeFnSymbol;
Review Comment:
thrift message has some required field, so we should set to it.
In nereids, this, this fields usually are null or empty string, we set this fields in ExpressionTranslator.visitAggregateFunction()
--
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-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] 924060929 merged pull request #14380: [Enhancement](Nereids) Refactor AggregateFunction and support explain plan
Posted by GitBox <gi...@apache.org>.
924060929 merged PR #14380:
URL: https://github.com/apache/doris/pull/14380
--
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-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] 924060929 commented on a diff in pull request #14380: [Enhancement](Nereids) Refactor AggregateFunction and support explain plan
Posted by GitBox <gi...@apache.org>.
924060929 commented on code in PR #14380:
URL: https://github.com/apache/doris/pull/14380#discussion_r1026276574
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/typecoercion/ExpectsInputTypes.java:
##########
@@ -35,4 +35,8 @@
public interface ExpectsInputTypes {
List<AbstractDataType> expectedInputTypes();
+
+ default void checkInputTypes() {
+
+ }
Review Comment:
for extends to check input types in the future
--
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-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] hello-stephen commented on pull request #14380: [Enhancement](Nereids) Refactor AggregateFunction and support explain plan
Posted by GitBox <gi...@apache.org>.
hello-stephen commented on PR #14380:
URL: https://github.com/apache/doris/pull/14380#issuecomment-1318829972
TeamCity pipeline, clickbench performance test result:
the sum of best hot time: 34.84 seconds
load time: 433 seconds
storage size: 17171224186 Bytes
https://doris-community-test-1308700295.cos.ap-hongkong.myqcloud.com/tmp/20221117154410_clickbench_pr_48242.html
--
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-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] 924060929 commented on a diff in pull request #14380: [Enhancement](Nereids) Refactor AggregateFunction and support explain plan
Posted by GitBox <gi...@apache.org>.
924060929 commented on code in PR #14380:
URL: https://github.com/apache/doris/pull/14380#discussion_r1026274244
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/ScalarFunction.java:
##########
@@ -74,6 +74,13 @@ public ScalarFunction(FunctionName fnName, List<Type> argTypes, Type retType, bo
NullableMode.DEPEND_ON_ARGUMENT);
}
+ /** nerieds custom scalar function */
+ public ScalarFunction(FunctionName fnName, List<Type> argTypes, Type retType, boolean hasVarArgs, String symbolName,
+ TFunctionBinaryType binaryType, boolean userVisible, boolean isVec, NullableMode nullableMode) {
Review Comment:
we set isVec to true in ExpressionTranslator.visitScalarFunction()
--
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-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] github-actions[bot] commented on pull request #14380: [Enhancement](Nereids) Refactor AggregateFunction and support explain plan
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #14380:
URL: https://github.com/apache/doris/pull/14380#issuecomment-1320170836
PR approved by at least one committer and no changes requested.
--
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-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] 924060929 commented on a diff in pull request #14380: [Enhancement](Nereids) Refactor AggregateFunction and support explain plan
Posted by GitBox <gi...@apache.org>.
924060929 commented on code in PR #14380:
URL: https://github.com/apache/doris/pull/14380#discussion_r1026273470
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/AggregateFunction.java:
##########
@@ -183,6 +183,30 @@ public AggregateFunction(FunctionName fnName, List<Type> argTypes,
returnsNonNullOnEmpty = false;
}
+ public AggregateFunction(FunctionName fnName, List<Type> argTypes,
+ Type retType, Type intermediateType, boolean hasVarArgs,
+ URI location, String updateFnSymbol, String initFnSymbol,
+ String serializeFnSymbol, String mergeFnSymbol, String getValueFnSymbol,
+ String removeFnSymbol, String finalizeFnSymbol, boolean ignoresDistinct,
+ boolean isAnalyticFn, boolean returnsNonNullOnEmpty, TFunctionBinaryType binaryType,
+ boolean userVisible, boolean vectorized, NullableMode nullableMode) {
+ // only `count` is always not nullable, other aggregate function is always nullable
+ super(0, fnName, argTypes, retType, hasVarArgs, binaryType, userVisible, vectorized, nullableMode);
+ setLocation(location);
+ this.intermediateType = (intermediateType.equals(retType)) ? null : intermediateType;
+ this.updateFnSymbol = updateFnSymbol;
+ this.initFnSymbol = initFnSymbol;
+ this.serializeFnSymbol = serializeFnSymbol;
+ this.mergeFnSymbol = mergeFnSymbol;
+ this.getValueFnSymbol = getValueFnSymbol;
+ this.removeFnSymbol = removeFnSymbol;
+ this.finalizeFnSymbol = finalizeFnSymbol;
Review Comment:
thrift message has some required fields, so we should set to it.
In nereids, this fields usually are null or empty string, we set this fields in ExpressionTranslator.visitAggregateFunction()
--
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-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] 924060929 commented on a diff in pull request #14380: [Enhancement](Nereids) Refactor AggregateFunction and support explain plan
Posted by GitBox <gi...@apache.org>.
924060929 commented on code in PR #14380:
URL: https://github.com/apache/doris/pull/14380#discussion_r1026295580
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/HllUnion.java:
##########
@@ -32,7 +32,11 @@
/** HllUnion */
public class HllUnion extends AggregateFunction
- implements UnaryExpression, PropagateNullable, ImplicitCastInputTypes {
+ implements UnaryExpression, AlwaysNotNullable, ExplicitlyCastableSignature {
+ public static final List<FunctionSignature> SIGNATURES = ImmutableList.of(
+ FunctionSignature.ret(HllType.INSTANCE).args(HllType.INSTANCE)
+ );
+
public HllUnion(Expression arg0) {
// TODO: change to hll_union in the future
Review Comment:
In the past, we can not find hll_union in frontend's FunctionSet.
Now, we don't need to find function in FunctionSet, so hll_union is available
--
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-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] github-actions[bot] commented on pull request #14380: [Enhancement](Nereids) Refactor AggregateFunction and support explain plan
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #14380:
URL: https://github.com/apache/doris/pull/14380#issuecomment-1320170884
PR approved by anyone and no changes requested.
--
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-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] 924060929 commented on a diff in pull request #14380: [Enhancement](Nereids) Refactor AggregateFunction and support explain plan
Posted by GitBox <gi...@apache.org>.
924060929 commented on code in PR #14380:
URL: https://github.com/apache/doris/pull/14380#discussion_r1026281332
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/AggregateFunction.java:
##########
@@ -183,6 +183,30 @@ public AggregateFunction(FunctionName fnName, List<Type> argTypes,
returnsNonNullOnEmpty = false;
}
+ public AggregateFunction(FunctionName fnName, List<Type> argTypes,
+ Type retType, Type intermediateType, boolean hasVarArgs,
+ URI location, String updateFnSymbol, String initFnSymbol,
+ String serializeFnSymbol, String mergeFnSymbol, String getValueFnSymbol,
+ String removeFnSymbol, String finalizeFnSymbol, boolean ignoresDistinct,
+ boolean isAnalyticFn, boolean returnsNonNullOnEmpty, TFunctionBinaryType binaryType,
+ boolean userVisible, boolean vectorized, NullableMode nullableMode) {
+ // only `count` is always not nullable, other aggregate function is always nullable
+ super(0, fnName, argTypes, retType, hasVarArgs, binaryType, userVisible, vectorized, nullableMode);
+ setLocation(location);
+ this.intermediateType = (intermediateType.equals(retType)) ? null : intermediateType;
+ this.updateFnSymbol = updateFnSymbol;
+ this.initFnSymbol = initFnSymbol;
+ this.serializeFnSymbol = serializeFnSymbol;
+ this.mergeFnSymbol = mergeFnSymbol;
+ this.getValueFnSymbol = getValueFnSymbol;
+ this.removeFnSymbol = removeFnSymbol;
+ this.finalizeFnSymbol = finalizeFnSymbol;
Review Comment:
I don't know whether should we need to set it in the future(for lateral view / window function)?
So make this field settable is conservative
--
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-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] 924060929 commented on a diff in pull request #14380: [Enhancement](Nereids) Refactor AggregateFunction and support explain plan
Posted by GitBox <gi...@apache.org>.
924060929 commented on code in PR #14380:
URL: https://github.com/apache/doris/pull/14380#discussion_r1026274825
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java:
##########
@@ -217,11 +217,7 @@ public PlanFragment visitPhysicalAggregate(
outputTupleDesc = localAggNode.getAggInfo().getOutputTupleDesc();
}
- if (aggregate.getAggPhase() == AggPhase.GLOBAL) {
- for (FunctionCallExpr execAggregateFunction : execAggregateFunctions) {
- execAggregateFunction.setMergeForNereids(true);
- }
- }
Review Comment:
already move to ExpressionTranslator.visitAggregateFunction(), there has a line:
```java
boolean isMergeFn = function.isGlobal() && function.isDisassembled();
```
--
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-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] morrySnow commented on a diff in pull request #14380: [Enhancement](Nereids) Refactor AggregateFunction and support explain plan
Posted by GitBox <gi...@apache.org>.
morrySnow commented on code in PR #14380:
URL: https://github.com/apache/doris/pull/14380#discussion_r1026157027
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/NereidsPlanner.java:
##########
@@ -64,18 +66,30 @@ public class NereidsPlanner extends Planner {
private List<ScanNode> scanNodeList = null;
private DescriptorTable descTable;
+ private Plan parsedPlan;
+ private Plan analyzedPlan;
+ private Plan rewrittenPlan;
+ private Plan optimizedPlan;
+
public NereidsPlanner(StatementContext statementContext) {
this.statementContext = statementContext;
}
@Override
- public void plan(StatementBase queryStmt, org.apache.doris.thrift.TQueryOptions queryOptions) throws UserException {
+ public void plan(StatementBase queryStmt, org.apache.doris.thrift.TQueryOptions queryOptions) {
if (!(queryStmt instanceof LogicalPlanAdapter)) {
throw new RuntimeException("Wrong type of queryStmt, expected: <? extends LogicalPlanAdapter>");
}
LogicalPlanAdapter logicalPlanAdapter = (LogicalPlanAdapter) queryStmt;
- PhysicalPlan physicalPlan = plan(logicalPlanAdapter.getLogicalPlan(), PhysicalProperties.ANY);
+ ExplainLevel explainLevel = getExplainLevel(queryStmt.getExplainOptions());
+ Plan resultPlan = plan(logicalPlanAdapter.getLogicalPlan(), PhysicalProperties.ANY, explainLevel);
+ if (explainLevel == ExplainLevel.PARSED_PLAN || explainLevel == ExplainLevel.ANALYZED_PLAN
+ || explainLevel == ExplainLevel.REWRITTEN_PLAN || explainLevel == ExplainLevel.OPTIMIZED_PLAN) {
Review Comment:
nit: add a function to ExplainLevel `isPlanLevel`
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/ScalarFunction.java:
##########
@@ -74,6 +74,13 @@ public ScalarFunction(FunctionName fnName, List<Type> argTypes, Type retType, bo
NullableMode.DEPEND_ON_ARGUMENT);
}
+ /** nerieds custom scalar function */
+ public ScalarFunction(FunctionName fnName, List<Type> argTypes, Type retType, boolean hasVarArgs, String symbolName,
+ TFunctionBinaryType binaryType, boolean userVisible, boolean isVec, NullableMode nullableMode) {
Review Comment:
isVec is always true, right?
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/BindFunction.java:
##########
@@ -171,7 +171,9 @@ public BoundFunction visitUnboundFunction(UnboundFunction unboundFunction, Env e
}
if (arguments.size() == 1) {
boolean isGlobalAgg = true;
- AggregateParam aggregateParam = new AggregateParam(unboundFunction.isDistinct(), isGlobalAgg);
+ boolean isDisassembled = false;
+ AggregateParam aggregateParam = new AggregateParam(
+ unboundFunction.isDistinct(), isGlobalAgg, isDisassembled);
Review Comment:
remove local var: isGlobalAgg and isDisassembled ?
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/AggregateFunction.java:
##########
@@ -183,6 +183,30 @@ public AggregateFunction(FunctionName fnName, List<Type> argTypes,
returnsNonNullOnEmpty = false;
}
+ public AggregateFunction(FunctionName fnName, List<Type> argTypes,
+ Type retType, Type intermediateType, boolean hasVarArgs,
+ URI location, String updateFnSymbol, String initFnSymbol,
+ String serializeFnSymbol, String mergeFnSymbol, String getValueFnSymbol,
+ String removeFnSymbol, String finalizeFnSymbol, boolean ignoresDistinct,
+ boolean isAnalyticFn, boolean returnsNonNullOnEmpty, TFunctionBinaryType binaryType,
+ boolean userVisible, boolean vectorized, NullableMode nullableMode) {
+ // only `count` is always not nullable, other aggregate function is always nullable
+ super(0, fnName, argTypes, retType, hasVarArgs, binaryType, userVisible, vectorized, nullableMode);
+ setLocation(location);
+ this.intermediateType = (intermediateType.equals(retType)) ? null : intermediateType;
+ this.updateFnSymbol = updateFnSymbol;
+ this.initFnSymbol = initFnSymbol;
+ this.serializeFnSymbol = serializeFnSymbol;
+ this.mergeFnSymbol = mergeFnSymbol;
+ this.getValueFnSymbol = getValueFnSymbol;
+ this.removeFnSymbol = removeFnSymbol;
+ this.finalizeFnSymbol = finalizeFnSymbol;
Review Comment:
do we still need this? use for UDAF?
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java:
##########
@@ -217,11 +217,7 @@ public PlanFragment visitPhysicalAggregate(
outputTupleDesc = localAggNode.getAggInfo().getOutputTupleDesc();
}
- if (aggregate.getAggPhase() == AggPhase.GLOBAL) {
- for (FunctionCallExpr execAggregateFunction : execAggregateFunctions) {
- execAggregateFunction.setMergeForNereids(true);
- }
- }
Review Comment:
why remove this?
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/HllUnion.java:
##########
@@ -32,7 +32,11 @@
/** HllUnion */
public class HllUnion extends AggregateFunction
- implements UnaryExpression, PropagateNullable, ImplicitCastInputTypes {
+ implements UnaryExpression, AlwaysNotNullable, ExplicitlyCastableSignature {
+ public static final List<FunctionSignature> SIGNATURES = ImmutableList.of(
+ FunctionSignature.ret(HllType.INSTANCE).args(HllType.INSTANCE)
+ );
+
public HllUnion(Expression arg0) {
// TODO: change to hll_union in the future
Review Comment:
add a reason to comment?
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/parser/NereidsParser.java:
##########
@@ -53,19 +53,20 @@ public class NereidsParser {
public List<StatementBase> parseSQL(String originStr) {
List<Pair<LogicalPlan, StatementContext>> logicalPlans = parseMultiple(originStr);
List<StatementBase> statementBases = Lists.newArrayList();
- for (Pair<LogicalPlan, StatementContext> logicalPlan : logicalPlans) {
+ for (Pair<LogicalPlan, StatementContext> parsedPlan2Context : logicalPlans) {
Review Comment:
nit: suggest to use To instead of 2
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Substring.java:
##########
@@ -66,8 +66,9 @@ public Substring(Expression arg0, Expression arg1, Expression arg2) {
}
@Override
- protected FunctionSignature computeSignature(FunctionSignature signature) {
- Optional<Expression> length = getLength();
+ protected FunctionSignature computeSignature(FunctionSignature signature, List<Expression> arguments) {
+ Optional<Expression> length = arguments.size() == 2
Review Comment:
why == 2 not 3?
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/typecoercion/ExpectsInputTypes.java:
##########
@@ -35,4 +35,8 @@
public interface ExpectsInputTypes {
List<AbstractDataType> expectedInputTypes();
+
+ default void checkInputTypes() {
+
+ }
Review Comment:
why we need a blank check?
--
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-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org