Skip to content

Commit

Permalink
X
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiqiang-hhhh committed Sep 29, 2024
1 parent bb701c0 commit 4a87a74
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
15 changes: 8 additions & 7 deletions be/src/pipeline/exec/aggregation_source_operator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,13 +394,14 @@ Status AggLocalState::_get_without_key_result(RuntimeState* state, vectorized::B
columns[i] = data_types[i]->create_column();

#ifndef NDEBUG
std::shared_ptr<IAggregateFunctionHelper> agg_function_helper =
std::dynamic_pointer_cast<vectorized::IAggregateFunctionHelper>(
shared_state.aggregate_evaluators[i]->function());
if (agg_function_helper) {
if (agg_function_helper->get_nullable_property == vectorized::AlwaysNullable) {
DCHECK(columns[i]->is_nullable());
}
if (shared_state.aggregate_evaluators[i]->function()->get_nullable_property() ==
vectorized::NullablePropertyEnum::ALWAYS_NULLABLE) {
DCHECK(data_types[i]->is_nullable()) << fmt::format(
"Query {}, AlwaysNullable aggregate function {} should return ColumnNullable, "
"but get {}",
print_id(state->query_id()),
shared_state.aggregate_evaluators[i]->function()->get_name(),
data_types[i]->get_name());
}
#endif
}
Expand Down
26 changes: 14 additions & 12 deletions be/src/vec/aggregate_functions/aggregate_function.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ using ConstAggregateDataPtr = const char*;
} \
} while (0)

enum struct NullableProperty : UInt8 {
AlwaysNotNullable = 0,
AlwaysNullable = 1,
PropograteNullable = 2,
NullableAggregateFunction = 3,
SkipNullablePropertyCheck = 4,
enum struct NullablePropertyEnum : UInt8 {
ALWAYS_NOT_NULLABLE = 0,
ALWAYS_NULLABLE = 1,
PROPOGATE_NULLABLE = 2,
NORMAL_NULLABLE = 3,
SKIP_NULLABLE_PROPERTY_CHECK = 4,
};

struct AlwaysNullable {
Expand Down Expand Up @@ -349,6 +349,8 @@ class IAggregateFunction {

virtual AggregateFunctionPtr transmit_to_stable() { return nullptr; }

virtual NullablePropertyEnum get_nullable_property() const = 0;

protected:
DataTypes argument_types;
int version {};
Expand All @@ -363,17 +365,17 @@ class IAggregateFunctionHelper : public IAggregateFunction {

using NullableProperty = NullablePropertyArg;

NullableProperty get_nullable_property() const {
NullablePropertyEnum get_nullable_property() const override {
if constexpr (std::is_same_v<NullableProperty, AlwaysNullable>) {
return NullableProperty::AlwaysNullable;
return NullablePropertyEnum::ALWAYS_NULLABLE;
} else if constexpr (std::is_same_v<NullableProperty, AlwaysNotNullable>) {
return NullableProperty::AlwaysNotNullable;
return NullablePropertyEnum::ALWAYS_NOT_NULLABLE;
} else if constexpr (std::is_same_v<NullableProperty, PropograteNullable>) {
return NullableProperty::PropograteNullable;
return NullablePropertyEnum::PROPOGATE_NULLABLE;
} else if constexpr (std::is_same_v<NullableProperty, NullableAggregateFunction>) {
return NullableProperty::NullableAggregateFunction;
return NullablePropertyEnum::NORMAL_NULLABLE;
} else if constexpr (std::is_same_v<NullableProperty, SkipNullablePropertyCheck>) {
return NullableProperty::SkipNullablePropertyCheck;
return NullablePropertyEnum::SKIP_NULLABLE_PROPERTY_CHECK;
} else {
throw doris::Exception(ErrorCode::INTERNAL_ERROR, "Unknown NullableProperty");
}
Expand Down

0 comments on commit 4a87a74

Please sign in to comment.