This impacts the Grafana plugin.

From https://github.com/grafana/clickhouse-datasource/issues/198


    if an adhoc filter is specified for the field t1_distributed.f2
        the following query will be built by the plugin SELECT f1 from t1_distributed settings additional_table_filters = {'t1_distributed': 'f2 = xxx'}
        this query will actually not do its job of filtering
        i guess it is coming from the fact that additional_table_filters are applied by clickhouse when it reads the table....but distributed tables are not read.....
        if i replace in the built query, within the additional_table_filters settings, t1_distributed with t1_local (so a query like `SELECT f1 from t1_distributed settings additional_table_filters = {'t1_local': 'f2 = xxx'}), then it is working as expected
    i gave a try to add an adhoc filter on the "local" table (while my "main" query is still on the distributed table) (ie define an adhoc filter on the fied t1_local.f2)
        then the built query by the plugin does not include any additional_table_filters settings (i guess there is a check in order to add additional_table_filters only on the table used in the query)




if (auto * process_list_element = context->getProcessListElement())
        user_level_throttler = process_list_element->getUserNetworkThrottler();
    
    ThrottlerPtr throttler;
    if (settings.max_network_bandwidth || settings.max_network_bytes)
    {
        throttler = std::make_shared<Throttler>(
                settings.max_network_bandwidth,
                settings.max_network_bytes,
                "Limit for bytes to send or receive over network exceeded.",
                user_level_throttler);
    }
    else
        throttler = user_level_throttler;
    std::vector<QueryPlanPtr> plans;
    size_t shards = query_info.getCluster()->getShardCount();
    for (const auto & shard_info : query_info.getCluster()->getShardsInfo())
    {
        ASTPtr query_ast_for_shard;
        if (query_info.optimized_cluster && settings.optimize_skip_unused_shards_rewrite_in && shards > 1)
        {
            query_ast_for_shard = query_ast->clone();
            OptimizeShardingKeyRewriteInVisitor::Data visitor_data{
                sharding_key_expr,
                sharding_key_expr->getSampleBlock().getByPosition(0).type,
                sharding_key_column_name,
                shard_info,
                not_optimized_cluster->getSlotToShard(),
            };
            OptimizeShardingKeyRewriteInVisitor visitor(visitor_data);