Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
BiteTheDDDDt committed Sep 29, 2024
1 parent 0d8019e commit 9d071b2
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 737 deletions.
16 changes: 1 addition & 15 deletions be/src/vec/aggregate_functions/aggregate_function_covar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,6 @@ AggregateFunctionPtr create_function_single_value(const String& name,
return nullptr;
}

template <bool is_nullable>
AggregateFunctionPtr create_aggregate_function_covariance_samp_old(const std::string& name,
const DataTypes& argument_types,
const bool result_is_nullable) {
return create_function_single_value<AggregateFunctionSamp_OLDER, CovarSampName, SampData_OLDER,
is_nullable>(name, argument_types, result_is_nullable,
NULLABLE);
}

AggregateFunctionPtr create_aggregate_function_covariance_samp(const std::string& name,
const DataTypes& argument_types,
const bool result_is_nullable) {
Expand All @@ -80,12 +71,7 @@ void register_aggregate_function_covar_pop(AggregateFunctionSimpleFactory& facto
}

void register_aggregate_function_covar_samp_old(AggregateFunctionSimpleFactory& factory) {
factory.register_alternative_function(
"covar_samp", create_aggregate_function_covariance_samp_old<NOTNULLABLE>, false,
AGG_FUNCTION_NULLABLE);
factory.register_alternative_function("covar_samp",
create_aggregate_function_covariance_samp_old<NULLABLE>,
true, AGG_FUNCTION_NULLABLE);
BeExecVersionManager::registe_restrict_function_compatibility("covar_samp");
}

void register_aggregate_function_covar_samp(AggregateFunctionSimpleFactory& factory) {
Expand Down
34 changes: 0 additions & 34 deletions be/src/vec/aggregate_functions/aggregate_function_covar.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,32 +137,6 @@ struct PopData : Data {
static DataTypePtr get_return_type() { return std::make_shared<DataTypeNumber<Float64>>(); }
};

template <typename T, typename Data>
struct SampData_OLDER : Data {
void insert_result_into(IColumn& to) const {
if (to.is_nullable()) {
ColumnNullable& nullable_column = assert_cast<ColumnNullable&>(to);
if (this->count == 1 || this->count == 0) {
nullable_column.insert_default();
} else {
auto& col = assert_cast<ColumnFloat64&>(nullable_column.get_nested_column());
col.get_data().push_back(this->get_samp_result());
nullable_column.get_null_map_data().push_back(0);
}
} else {
auto& col = assert_cast<ColumnFloat64&>(to);
if (this->count == 1 || this->count == 0) {
col.insert_default();
} else {
col.get_data().push_back(this->get_samp_result());
}
}
}
static DataTypePtr get_return_type() {
return make_nullable(std::make_shared<DataTypeNumber<Float64>>());
}
};

template <typename T, typename Data>
struct SampData : Data {
void insert_result_into(IColumn& to) const {
Expand Down Expand Up @@ -258,14 +232,6 @@ class AggregateFunctionSampCovariance
}
};

template <typename Data, bool is_nullable>
class AggregateFunctionSamp_OLDER final
: public AggregateFunctionSampCovariance<NOTPOP, Data, is_nullable> {
public:
AggregateFunctionSamp_OLDER(const DataTypes& argument_types_)
: AggregateFunctionSampCovariance<NOTPOP, Data, is_nullable>(argument_types_) {}
};

template <typename Data, bool is_nullable>
class AggregateFunctionSamp final
: public AggregateFunctionSampCovariance<NOTPOP, Data, is_nullable> {
Expand Down
62 changes: 6 additions & 56 deletions be/src/vec/aggregate_functions/aggregate_function_percentile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,6 @@

namespace doris::vectorized {

template <bool is_nullable>
AggregateFunctionPtr create_aggregate_function_percentile_approx_older(
const std::string& name, const DataTypes& argument_types, const bool result_is_nullable) {
const DataTypePtr& argument_type = remove_nullable(argument_types[0]);
WhichDataType which(argument_type);
if (which.idx != TypeIndex::Float64) {
return nullptr;
}
if (argument_types.size() == 2) {
return creator_without_type::create<
AggregateFunctionPercentileApproxTwoParams_OLDER<is_nullable>>(
remove_nullable(argument_types), result_is_nullable);
}
if (argument_types.size() == 3) {
return creator_without_type::create<
AggregateFunctionPercentileApproxThreeParams_OLDER<is_nullable>>(
remove_nullable(argument_types), result_is_nullable);
}
return nullptr;
}

AggregateFunctionPtr create_aggregate_function_percentile_approx(const std::string& name,
const DataTypes& argument_types,
const bool result_is_nullable) {
Expand All @@ -63,27 +42,6 @@ AggregateFunctionPtr create_aggregate_function_percentile_approx(const std::stri
return nullptr;
}

template <bool is_nullable>
AggregateFunctionPtr create_aggregate_function_percentile_approx_weighted_older(
const std::string& name, const DataTypes& argument_types, const bool result_is_nullable) {
const DataTypePtr& argument_type = remove_nullable(argument_types[0]);
WhichDataType which(argument_type);
if (which.idx != TypeIndex::Float64) {
return nullptr;
}
if (argument_types.size() == 3) {
return creator_without_type::create<
AggregateFunctionPercentileApproxWeightedThreeParams_OLDER<is_nullable>>(
remove_nullable(argument_types), result_is_nullable);
}
if (argument_types.size() == 4) {
return creator_without_type::create<
AggregateFunctionPercentileApproxWeightedFourParams_OLDER<is_nullable>>(
remove_nullable(argument_types), result_is_nullable);
}
return nullptr;
}

AggregateFunctionPtr create_aggregate_function_percentile_approx_weighted(
const std::string& name, const DataTypes& argument_types, const bool result_is_nullable) {
const DataTypePtr& argument_type = remove_nullable(argument_types[0]);
Expand Down Expand Up @@ -111,20 +69,12 @@ void register_aggregate_function_percentile(AggregateFunctionSimpleFactory& fact
}

void register_percentile_approx_old_function(AggregateFunctionSimpleFactory& factory) {
factory.register_alternative_function("percentile_approx",
create_aggregate_function_percentile_approx_older<false>,
false, AGG_FUNCTION_NULLABLE);
factory.register_alternative_function("percentile_approx",
create_aggregate_function_percentile_approx_older<true>,
true, AGG_FUNCTION_NULLABLE);
factory.register_alternative_function(
"percentile_approx_weighted",
create_aggregate_function_percentile_approx_weighted_older<false>, false,
AGG_FUNCTION_NULLABLE);
factory.register_alternative_function(
"percentile_approx_weighted",
create_aggregate_function_percentile_approx_weighted_older<true>, true,
AGG_FUNCTION_NULLABLE);
BeExecVersionManager::registe_restrict_function_compatibility("percentile_approx");
BeExecVersionManager::registe_restrict_function_compatibility("percentile_approx_weighted");
}

void register_aggregate_function_percentile_old(AggregateFunctionSimpleFactory& factory) {
BeExecVersionManager::registe_restrict_function_compatibility("percentile");
}

void register_aggregate_function_percentile_approx(AggregateFunctionSimpleFactory& factory) {
Expand Down
Loading

0 comments on commit 9d071b2

Please sign in to comment.