zhangstar333 commented on code in PR #38608:
URL: https://github.com/apache/doris/pull/38608#discussion_r1698531242
##########
be/src/vec/aggregate_functions/aggregate_function_histogram.h:
##########
@@ -186,13 +198,18 @@ class AggregateFunctionHistogram final
void add(AggregateDataPtr __restrict place, const IColumn** columns,
ssize_t row_num,
Arena* arena) const override {
- if (columns[0]->is_null_at(row_num)) {
- return;
- }
-
- if (has_input_param) {
+ if constexpr (has_input_param) {
+ Int32 input_max_num_buckets =
+ assert_cast<const
ColumnInt32*>(columns[1])->get_element(row_num);
+ if (input_max_num_buckets <= 0) {
+ throw doris::Exception(ErrorCode::INVALID_ARGUMENT,
+ "Invalid max_num_buckets {}, row_num
{}",
+ input_max_num_buckets, row_num);
+ }
this->data(place).set_parameters(
assert_cast<const
ColumnInt32*>(columns[1])->get_element(row_num));
Review Comment:
here could use input_max_num_buckets directly
##########
be/src/vec/aggregate_functions/aggregate_function_histogram.h:
##########
@@ -86,7 +92,9 @@ struct AggregateFunctionHistogramData {
}
void merge(const AggregateFunctionHistogramData& rhs) {
- if (!rhs.max_num_buckets) {
+ // if rhs.max_num_buckets == 1, it means the input block for
serialization is all null
Review Comment:
rhs.max_num_buckets == 1, seems is means == -1?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]