diff --git a/be/src/olap/memtable.cpp b/be/src/olap/memtable.cpp index 6d8975e84c..ae0165b9fc 100644 --- a/be/src/olap/memtable.cpp +++ b/be/src/olap/memtable.cpp @@ -111,6 +111,10 @@ void MemTable::_init_agg_functions(const vectorized::Block* block) { } else { function = _tablet_schema->column(cid).get_aggregate_function(vectorized::AGG_LOAD_SUFFIX); + if (function == nullptr) { + LOG(WARNING) << "column get aggregate function failed, column=" + << _tablet_schema->column(cid).name(); + } } DCHECK(function != nullptr); diff --git a/be/src/olap/tablet_schema.cpp b/be/src/olap/tablet_schema.cpp index 414036ab58..c02e876cd7 100644 --- a/be/src/olap/tablet_schema.cpp +++ b/be/src/olap/tablet_schema.cpp @@ -506,7 +506,7 @@ vectorized::AggregateFunctionPtr TabletColumn::get_aggregate_function(std::strin std::string origin_name = TabletColumn::get_string_by_aggregation_type(_aggregation); auto type = vectorized::DataTypeFactory::instance().create_data_type(*this); - std::string agg_name = TabletColumn::get_string_by_aggregation_type(_aggregation) + suffix; + std::string agg_name = origin_name + suffix; std::transform(agg_name.begin(), agg_name.end(), agg_name.begin(), [](unsigned char c) { return std::tolower(c); }); @@ -515,6 +515,11 @@ vectorized::AggregateFunctionPtr TabletColumn::get_aggregate_function(std::strin if (function) { return function; } + if (type->get_type_as_primitive_type() != PrimitiveType::TYPE_AGG_STATE) { + LOG(WARNING) << "get column aggregate function failed, aggregation_name=" << origin_name + << ", column_type=" << type->get_name(); + return nullptr; + } return get_aggregate_function_union(type); }