**Describe the issue**
We have to set macro or to pass explicitly shard and replica name to create table in DatabaseReplicated

}
    auto with_original_arguments = getImpl(name, type_without_low_cardinality, parameters, out_properties, false);
    if (!with_original_arguments)
        throw Exception("Logical error: AggregateFunctionFactory returned nullptr", ErrorCodes::LOGICAL_ERROR);
    return with_original_arguments;
}
AggregateFunctionPtr AggregateFunctionFactory::getImpl(
    const String & name_param,
    const DataTypes & argument_types,
    const Array & parameters,
    AggregateFunctionProperties & out_properties,
    bool has_null_arguments) const
{
    String name = getAliasToOrName(name_param);
    bool is_case_insensitive = false;
    Value found;
    
    if (auto it = aggregate_functions.find(name); it != aggregate_functions.end())
    {
        found = it->second;
    }
    if (auto jt = case_insensitive_aggregate_functions.find(Poco::toLower(name)); jt != case_insensitive_aggregate_functions.end())
    {
        found = jt->second;
        is_case_insensitive = true;
    }
    ContextPtr query_context;
    if (CurrentThread::isInitialized())
        query_context = CurrentThread::get().getQueryContext();
    if (found.creator)