[Bug](Agg-State) fix agg state function get wrong input argument list (#20546)
fix agg state function get wrong input argument list
This commit is contained in:
@ -48,6 +48,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "common/config.h"
|
||||
#include "common/exception.h"
|
||||
#include "common/logging.h"
|
||||
#include "gutil/integral_types.h"
|
||||
#include "http/http_client.h"
|
||||
@ -282,7 +283,11 @@ void PInternalServiceImpl::exec_plan_fragment(google::protobuf::RpcController* c
|
||||
bool compact = request->has_compact() ? request->compact() : false;
|
||||
PFragmentRequestVersion version =
|
||||
request->has_version() ? request->version() : PFragmentRequestVersion::VERSION_1;
|
||||
st = _exec_plan_fragment(request->request(), version, compact);
|
||||
try {
|
||||
st = _exec_plan_fragment(request->request(), version, compact);
|
||||
} catch (const doris::Exception& e) {
|
||||
st = Status::Error(e.code(), e.to_string());
|
||||
}
|
||||
if (!st.ok()) {
|
||||
LOG(WARNING) << "exec plan fragment failed, errmsg=" << st;
|
||||
}
|
||||
|
||||
@ -29,6 +29,8 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "common/exception.h"
|
||||
#include "common/status.h"
|
||||
#include "vec/aggregate_functions/aggregate_function.h"
|
||||
#include "vec/aggregate_functions/aggregate_function_simple_factory.h"
|
||||
#include "vec/columns/column_fixed_length_object.h"
|
||||
@ -53,22 +55,20 @@ public:
|
||||
: _result_is_nullable(result_is_nullable),
|
||||
_sub_types(sub_types),
|
||||
_function_name(function_name) {
|
||||
_agg_function = get_nested_function();
|
||||
DCHECK(_agg_function != nullptr);
|
||||
_agg_function = AggregateFunctionSimpleFactory::instance().get(_function_name, _sub_types,
|
||||
_result_is_nullable);
|
||||
if (_agg_function == nullptr) {
|
||||
throw Exception(ErrorCode::INVALID_ARGUMENT,
|
||||
"DataTypeAggState function get failed, type={}", do_get_name());
|
||||
}
|
||||
_agg_serialized_type = _agg_function->get_serialized_type();
|
||||
}
|
||||
|
||||
const char* get_family_name() const override { return "AggState"; }
|
||||
|
||||
std::string do_get_name() const override {
|
||||
std::string types;
|
||||
for (auto type : _sub_types) {
|
||||
if (!types.empty()) {
|
||||
types += ", ";
|
||||
}
|
||||
types += type->get_name();
|
||||
}
|
||||
return "AggState(" + types + ")";
|
||||
return fmt::format("AggState(function_name={},result_is_nullable={},arguments=[{}])",
|
||||
_function_name, _result_is_nullable, get_types_string());
|
||||
}
|
||||
|
||||
TypeIndex get_type_id() const override { return TypeIndex::AggState; }
|
||||
@ -100,10 +100,7 @@ public:
|
||||
col_meta->set_result_is_nullable(_result_is_nullable);
|
||||
}
|
||||
|
||||
AggregateFunctionPtr get_nested_function() const {
|
||||
return AggregateFunctionSimpleFactory::instance().get(_function_name, _sub_types,
|
||||
_result_is_nullable);
|
||||
}
|
||||
AggregateFunctionPtr get_nested_function() const { return _agg_function; }
|
||||
|
||||
int64_t get_uncompressed_serialized_bytes(const IColumn& column,
|
||||
int be_exec_version) const override {
|
||||
@ -128,6 +125,17 @@ public:
|
||||
DataTypePtr get_serialized_type() const { return _agg_serialized_type; }
|
||||
|
||||
private:
|
||||
std::string get_types_string() const {
|
||||
std::string types;
|
||||
for (auto type : _sub_types) {
|
||||
if (!types.empty()) {
|
||||
types += ", ";
|
||||
}
|
||||
types += type->get_name();
|
||||
}
|
||||
return types;
|
||||
}
|
||||
|
||||
bool _result_is_nullable;
|
||||
//because the agg_state type maybe mapped to ColumnString or ColumnFixedLengthObject
|
||||
DataTypePtr _agg_serialized_type;
|
||||
|
||||
@ -541,11 +541,6 @@ public class Function implements Writable {
|
||||
fn.setArgTypes(Type.toThrift(Lists.newArrayList(argTypes), Lists.newArrayList(realArgTypes)));
|
||||
}
|
||||
|
||||
if (realReturnType.isAggStateType()) {
|
||||
realReturnType = Expr.createAggStateType(((AggStateType) realReturnType), Arrays.asList(realArgTypes),
|
||||
Arrays.asList(realArgTypeNullables));
|
||||
}
|
||||
|
||||
// For types with different precisions and scales, return type only indicates a
|
||||
// type with default
|
||||
// precision and scale so we need to transform it to the correct type.
|
||||
|
||||
Reference in New Issue
Block a user