Merge pull request #50234 from azat/fix-nested-dist-cte

Fix nested distributed SELECT in WITH clause
This commit is contained in:
Dmitry Novik 2023-06-05 13:18:50 +02:00 committed by GitHub
commit 8e51a15606
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 0 deletions

View File

@ -60,6 +60,15 @@ ColumnsDescription getStructureOfRemoteTableInShard(
ColumnsDescription res;
auto new_context = ClusterProxy::updateSettingsForCluster(cluster, context, context->getSettingsRef(), table_id);
/// Ignore limit for result number of rows (that could be set during handling CSE/CTE),
/// since this is a service query and should not lead to query failure.
{
Settings new_settings = new_context->getSettings();
new_settings.max_result_rows = 0;
new_settings.max_result_bytes = 0;
new_context->setSettings(new_settings);
}
/// Expect only needed columns from the result of DESC TABLE. NOTE 'comment' column is ignored for compatibility reasons.
Block sample_block
{

View File

@ -0,0 +1,3 @@
1
1
1

View File

@ -0,0 +1,5 @@
with (select count() > 0 from remote('127.2', system.settings)) as s select s;
-- nested
with (select count() > 0 from remote('127.2', remote('127.2', system.settings))) as s select s;
-- nested via view()
with (select count() > 0 from remote('127.2', view(select count() from remote('127.2', system.settings)))) as s select s;