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)




return storage_ptr->getInMemoryMetadataPtr()->getColumns();
        }
        
        query = "DESC TABLE " + table_id.getFullTableName();
    }
    ColumnsDescription res;
    auto new_context = ClusterProxy::updateSettingsForCluster(cluster, context, context->getSettingsRef());
    
    Block sample_block
    {
        { ColumnString::create(), std::make_shared<DataTypeString>(), "name" },
        { ColumnString::create(), std::make_shared<DataTypeString>(), "type" },
        { ColumnString::create(), std::make_shared<DataTypeString>(), "default_type" },
        { ColumnString::create(), std::make_shared<DataTypeString>(), "default_expression" },
    };
    
    RemoteQueryExecutor executor(shard_info.pool, query, sample_block, new_context);
    executor.setPoolMode(PoolMode::GET_ONE);
    if (!table_func_ptr)
        executor.setMainTable(table_id);
    const DataTypeFactory & data_type_factory = DataTypeFactory::instance();
    ParserExpression expr_parser;
    while (Block current = executor.read())
    {
        ColumnPtr name = current.getByName("name").column;
        ColumnPtr type = current.getByName("type").column;
        ColumnPtr default_kind = current.getByName("default_type").column;
        ColumnPtr default_expr = current.getByName("default_expression").column;
        size_t size = name->size();
        for (size_t i = 0; i < size; ++i)