[Feature](function) support group concat with distinct and order by (#38851)

pick from #38744 and #38776
This commit is contained in:
Pxl
2024-08-05 15:44:51 +08:00
committed by GitHub
parent 5dfc5d2c77
commit 86ef0069ea
7 changed files with 200 additions and 114 deletions

View File

@ -29,6 +29,16 @@
namespace doris::vectorized {
template <typename T>
struct Reducer {
template <bool stable>
using Output = AggregateFunctionDistinctSingleNumericData<T, stable>;
using AggregateFunctionDistinctNormal = AggregateFunctionDistinct<Output, false>;
};
template <typename T>
using AggregateFunctionDistinctNumeric = Reducer<T>::AggregateFunctionDistinctNormal;
class AggregateFunctionCombinatorDistinct final : public IAggregateFunctionCombinator {
public:
String get_name() const override { return "Distinct"; }
@ -51,22 +61,15 @@ public:
if (arguments.size() == 1) {
AggregateFunctionPtr res(
creator_with_numeric_type::create<AggregateFunctionDistinct,
AggregateFunctionDistinctSingleNumericData>(
creator_with_numeric_type::create<AggregateFunctionDistinctNumeric>(
arguments, result_is_nullable, nested_function));
if (res) {
return res;
}
if (arguments[0]->is_value_unambiguously_represented_in_contiguous_memory_region()) {
res = creator_without_type::create<AggregateFunctionDistinct<
AggregateFunctionDistinctSingleGenericData<true>>>(
arguments, result_is_nullable, nested_function);
} else {
res = creator_without_type::create<AggregateFunctionDistinct<
AggregateFunctionDistinctSingleGenericData<false>>>(
arguments, result_is_nullable, nested_function);
}
res = creator_without_type::create<
AggregateFunctionDistinct<AggregateFunctionDistinctSingleGenericData>>(
arguments, result_is_nullable, nested_function);
return res;
}
return creator_without_type::create<