mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 01:22:04 +00:00
Analyzer: Remove constants from header in StorageDistributed
This commit is contained in:
parent
e8422414b0
commit
1aa18e0eb6
@ -742,12 +742,16 @@ void StorageDistributed::read(
|
||||
remote_storage_id,
|
||||
remote_table_function_ptr);
|
||||
header = InterpreterSelectQueryAnalyzer::getSampleBlock(query_tree_distributed, local_context, SelectQueryOptions(processed_stage).analyze());
|
||||
/** For distributed tables we do not need constants in header, since we don't send them to remote servers.
|
||||
* Moreover, constants can break some functions like `hostName` that are constants only for local queries.
|
||||
*/
|
||||
for (auto & column : header)
|
||||
column.column = column.column->convertToFullColumnIfConst();
|
||||
query_ast = queryNodeToSelectQuery(query_tree_distributed);
|
||||
}
|
||||
else
|
||||
{
|
||||
header =
|
||||
InterpreterSelectQuery(query_info.query, local_context, SelectQueryOptions(processed_stage).analyze()).getSampleBlock();
|
||||
header = InterpreterSelectQuery(query_info.query, local_context, SelectQueryOptions(processed_stage).analyze()).getSampleBlock();
|
||||
query_ast = query_info.query;
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,13 @@ def test_cluster(start_cluster):
|
||||
)
|
||||
== "node1\nnode2\n"
|
||||
)
|
||||
|
||||
assert set(
|
||||
node1.query(
|
||||
"""SELECT hostName(), * FROM clusterAllReplicas("one_shard_two_nodes", system.one) ORDER BY dummy"""
|
||||
).splitlines()
|
||||
) == {"node1\t0", "node2\t0"}
|
||||
|
||||
assert (
|
||||
node1.query("SELECT hostName() FROM cluster('one_shard_two_nodes', system.one)")
|
||||
== "node1\n"
|
||||
|
Loading…
Reference in New Issue
Block a user