diff --git a/src/Client/HedgedConnections.cpp b/src/Client/HedgedConnections.cpp index 7ea13a7dffc..9fa79dd6b77 100644 --- a/src/Client/HedgedConnections.cpp +++ b/src/Client/HedgedConnections.cpp @@ -177,6 +177,10 @@ void HedgedConnections::sendQuery( { Settings modified_settings = settings; + /// Queries in foreign languages are transformed to ClickHouse-SQL. Ensure the setting before sending. + modified_settings.dialect = Dialect::clickhouse; + modified_settings.dialect.changed = false; + if (disable_two_level_aggregation) { /// Disable two-level aggregation due to version incompatibility. diff --git a/src/Client/MultiplexedConnections.cpp b/src/Client/MultiplexedConnections.cpp index 8433c8afe9f..5d0fc8fd39e 100644 --- a/src/Client/MultiplexedConnections.cpp +++ b/src/Client/MultiplexedConnections.cpp @@ -126,6 +126,10 @@ void MultiplexedConnections::sendQuery( Settings modified_settings = settings; + /// Queries in foreign languages are transformed to ClickHouse-SQL. Ensure the setting before sending. + modified_settings.dialect = Dialect::clickhouse; + modified_settings.dialect.changed = false; + for (auto & replica : replica_states) { if (!replica.connection) diff --git a/tests/queries/0_stateless/02985_dialects_with_distributed_tables.reference b/tests/queries/0_stateless/02985_dialects_with_distributed_tables.reference new file mode 100644 index 00000000000..f22e294ce86 --- /dev/null +++ b/tests/queries/0_stateless/02985_dialects_with_distributed_tables.reference @@ -0,0 +1,9 @@ +123 +234 +315 +123 +234 +315 +123 +234 +315 diff --git a/tests/queries/0_stateless/02985_dialects_with_distributed_tables.sql b/tests/queries/0_stateless/02985_dialects_with_distributed_tables.sql new file mode 100644 index 00000000000..6ac36cf5835 --- /dev/null +++ b/tests/queries/0_stateless/02985_dialects_with_distributed_tables.sql @@ -0,0 +1,30 @@ +-- Tags: no-fasttest, distributed + +DROP TABLE IF EXISTS shared_test_table; +DROP TABLE IF EXISTS distributed_test_table; + +CREATE TABLE shared_test_table (id UInt64) +ENGINE = MergeTree +ORDER BY (id); + +CREATE TABLE distributed_test_table +ENGINE = Distributed(test_cluster_two_shard_three_replicas_localhost, currentDatabase(), shared_test_table); + +INSERT INTO shared_test_table VALUES (123), (651), (446), (315), (234), (764); + +SELECT id FROM distributed_test_table LIMIT 3; + +SET dialect = 'kusto'; + +distributed_test_table | take 3; + +SET dialect = 'prql'; + +from distributed_test_table +select {id} +take 1..3; + +SET dialect = 'clickhouse'; + +DROP TABLE distributed_test_table; +DROP TABLE shared_test_table;