This commit is contained in:
Igor Nikonov 2024-05-15 11:19:03 +00:00
parent de5ba95639
commit 6faa4dd20c

View File

@ -873,19 +873,18 @@ JoinTreeQueryPlan buildQueryPlanForTableExpression(QueryTreeNodePtr table_expres
ReadFromMergeTree * reading = nullptr; ReadFromMergeTree * reading = nullptr;
while (node) while (node)
{ {
IQueryPlanStep * step = typeid_cast<ISourceStep *>(node->step.get()); reading = typeid_cast<ReadFromMergeTree *>(node->step.get());
if (step) if (reading)
{
reading = typeid_cast<ReadFromMergeTree *>(step);
break; break;
}
if (!node->children.empty()) if (!node->children.empty())
node = node->children.at(0); node = node->children.at(0);
} }
chassert(reading);
// (2) if it's ReadFromMergeTree - run index analysis and check number of rows to read // (2) if it's ReadFromMergeTree - run index analysis and check number of rows to read
if (reading && settings.parallel_replicas_min_number_of_rows_per_replica > 0) if (settings.parallel_replicas_min_number_of_rows_per_replica > 0)
{ {
auto result_ptr = reading->selectRangesToRead(reading->getParts(), reading->getAlterConvertionsForParts()); auto result_ptr = reading->selectRangesToRead(reading->getParts(), reading->getAlterConvertionsForParts());