Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug](compatibility) fix stddev_samp function coredump when upgrade #40438

Merged
merged 1 commit into from
Sep 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletions be/src/vec/aggregate_functions/aggregate_function_stddev.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@ struct BaseData {
count += 1;
}

static DataTypePtr get_return_type() { return std::make_shared<DataTypeNumber<Float64>>(); }

double mean;
double m2;
int64_t count;
Expand All @@ -145,6 +143,8 @@ struct PopData : Data {
col.get_data().push_back(this->get_pop_result());
}
}

static DataTypePtr get_return_type() { return std::make_shared<DataTypeNumber<Float64>>(); }
};

// For this series of functions, the Decimal type is not supported
Expand Down Expand Up @@ -189,6 +189,10 @@ struct SampData_OLDER : Data {
nullable_column.get_null_map_data().push_back(0);
}
}

static DataTypePtr get_return_type() {
return make_nullable(std::make_shared<DataTypeNumber<Float64>>());
}
};

template <typename T, typename Data>
Expand All @@ -207,6 +211,8 @@ struct SampData : Data {
}
}
}

static DataTypePtr get_return_type() { return std::make_shared<DataTypeNumber<Float64>>(); }
};

template <bool is_pop, typename Data, bool is_nullable>
Expand All @@ -221,17 +227,7 @@ class AggregateFunctionSampVariance

String get_name() const override { return Data::name(); }

DataTypePtr get_return_type() const override {
if constexpr (is_pop) {
return Data::get_return_type();
} else {
if (IAggregateFunction::version < AGG_FUNCTION_NULLABLE) {
return make_nullable(Data::get_return_type());
} else {
return Data::get_return_type();
}
}
}
DataTypePtr get_return_type() const override { return Data::get_return_type(); }

void add(AggregateDataPtr __restrict place, const IColumn** columns, ssize_t row_num,
Arena*) const override {
Expand Down
Loading