This is an automated email from the ASF dual-hosted git repository.
lihaopeng 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 c14277e587 [fix](analytic) fix coredump cause by empty analytic
parameter types (#13808)
c14277e587 is described below
commit c14277e5877efef5b9090725ba7bc63bf8c24314
Author: TengJianPing <[email protected]>
AuthorDate: Tue Nov 1 17:25:36 2022 +0800
[fix](analytic) fix coredump cause by empty analytic parameter types
(#13808)
* fix fe compile error
---
be/src/vec/exprs/vectorized_agg_fn.cpp | 24 +++++++++++++++-------
.../org/apache/doris/analysis/FunctionParams.java | 4 +++-
gensrc/thrift/Exprs.thrift | 2 +-
3 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/be/src/vec/exprs/vectorized_agg_fn.cpp
b/be/src/vec/exprs/vectorized_agg_fn.cpp
index a326c2348d..dc88b7f07f 100644
--- a/be/src/vec/exprs/vectorized_agg_fn.cpp
+++ b/be/src/vec/exprs/vectorized_agg_fn.cpp
@@ -45,10 +45,12 @@ AggFnEvaluator::AggFnEvaluator(const TExprNode& desc)
}
_data_type = DataTypeFactory::instance().create_data_type(_return_type,
nullable);
- auto& param_types = desc.agg_expr.param_types;
- for (int i = 0; i < param_types.size(); i++) {
- _argument_types_with_sort.push_back(
- DataTypeFactory::instance().create_data_type(param_types[i]));
+ if (desc.agg_expr.__isset.param_types) {
+ auto& param_types = desc.agg_expr.param_types;
+ for (int i = 0; i < param_types.size(); i++) {
+ _argument_types_with_sort.push_back(
+
DataTypeFactory::instance().create_data_type(param_types[i]));
+ }
}
}
@@ -96,24 +98,32 @@ Status AggFnEvaluator::prepare(RuntimeState* state, const
RowDescriptor& desc, M
Status status = VExpr::prepare(_input_exprs_ctxs, state, desc);
RETURN_IF_ERROR(status);
+ DataTypes tmp_argument_types;
+ tmp_argument_types.reserve(_input_exprs_ctxs.size());
+
std::vector<std::string_view> child_expr_name;
// prepare for argument
for (int i = 0; i < _input_exprs_ctxs.size(); ++i) {
+ auto data_type = _input_exprs_ctxs[i]->root()->data_type();
+ tmp_argument_types.emplace_back(data_type);
child_expr_name.emplace_back(_input_exprs_ctxs[i]->root()->expr_name());
}
+ const DataTypes& argument_types =
+ _real_argument_types.empty() ? tmp_argument_types :
_real_argument_types;
+
if (_fn.binary_type == TFunctionBinaryType::JAVA_UDF) {
#ifdef LIBJVM
- _function = AggregateJavaUdaf::create(_fn, _real_argument_types, {},
_data_type);
+ _function = AggregateJavaUdaf::create(_fn, argument_types, {},
_data_type);
#else
return Status::InternalError("Java UDAF is disabled since no libjvm is
found!");
#endif
} else if (_fn.binary_type == TFunctionBinaryType::RPC) {
- _function = AggregateRpcUdaf::create(_fn, _real_argument_types, {},
_data_type);
+ _function = AggregateRpcUdaf::create(_fn, argument_types, {},
_data_type);
} else {
_function = AggregateFunctionSimpleFactory::instance().get(
- _fn.name.function_name, _real_argument_types, {},
_data_type->is_nullable());
+ _fn.name.function_name, argument_types, {},
_data_type->is_nullable());
}
if (_function == nullptr) {
return Status::InternalError("Agg Function {} is not implemented",
_fn.name.function_name);
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionParams.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionParams.java
index 3968a736a1..dc5a5f53c8 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionParams.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionParams.java
@@ -83,7 +83,9 @@ public class FunctionParams implements Writable {
paramTypes.add(desc);
}
}
- return new TAggregateExpr(isMergeAggFn, paramTypes);
+ TAggregateExpr aggExpr = new TAggregateExpr(isMergeAggFn);
+ aggExpr.setParamTypes(paramTypes);
+ return aggExpr;
}
public boolean isStar() {
diff --git a/gensrc/thrift/Exprs.thrift b/gensrc/thrift/Exprs.thrift
index acb69ad184..5d20ec12ee 100644
--- a/gensrc/thrift/Exprs.thrift
+++ b/gensrc/thrift/Exprs.thrift
@@ -76,7 +76,7 @@ enum TExprNodeType {
struct TAggregateExpr {
// Indicates whether this expr is the merge() of an aggregation.
1: required bool is_merge_agg
- 2: required list<Types.TTypeDesc> param_types
+ 2: optional list<Types.TTypeDesc> param_types
}
struct TBoolLiteral {
1: required bool value
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]