`SELECT toDateTime(topKWeighted(-9223372036854775807, '-0.02')(NULL), '104857.5') FROM remote('127.0\00\0{2,3}127.0\00\0{2,3}127.0\00\0{2,3}127.0\00\0{2,3}127.0\00\0{2,3}127.0\00\0{2,3}127.0\00\0{2,3}127.0\00\0{2,3}', system.one) ORDER BY length(topK(1048577)(tuple(NULL))) ASC, '0' ASC NULLS LAST`
{
private:
    using State = AggregateFunctionTopKGenericData;
    UInt64 threshold;
    UInt64 reserved;
    DataTypePtr & input_data_type;
    static void deserializeAndInsert(StringRef str, IColumn & data_to);
public:
    AggregateFunctionTopKGeneric(
        UInt64 threshold_, UInt64 load_factor, const DataTypePtr & input_data_type_, const Array & params)
        : IAggregateFunctionDataHelper<AggregateFunctionTopKGenericData, AggregateFunctionTopKGeneric<is_plain_column, is_weighted>>({input_data_type_}, params)
        , threshold(threshold_), reserved(load_factor * threshold), input_data_type(this->argument_types[0]) {}
    String getName() const override { return is_weighted ? "topKWeighted" : "topK"; }
    DataTypePtr getReturnType() const override
    {
        return std::make_shared<DataTypeArray>(input_data_type);
    }
    bool allocatesMemoryInArena() const override