Update copier to use group by to find partitions (#47386)

This commit is contained in:
Clayton McClure 2023-03-09 07:49:00 -07:00 committed by GitHub
parent 113c98edb9
commit b0931c8967
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1867,8 +1867,8 @@ std::set<String> ClusterCopier::getShardPartitions(const ConnectionTimeouts & ti
String query;
{
WriteBufferFromOwnString wb;
wb << "SELECT DISTINCT " << partition_name << " AS partition FROM"
<< " " << getQuotedTable(task_shard.table_read_shard) << " ORDER BY partition DESC";
wb << "SELECT " << partition_name << " AS partition FROM "
<< getQuotedTable(task_shard.table_read_shard) << " GROUP BY partition ORDER BY partition DESC";
query = wb.str();
}