Fix more tests.

This commit is contained in:
Nikolai Kochetov 2024-06-10 17:02:26 +00:00
parent a8b1b11ee6
commit 20d673a206
2 changed files with 14 additions and 32 deletions

View File

@ -1215,35 +1215,14 @@ QueryPlan ReadFromMerge::createPlanForTable(
if (real_column_names.empty())
real_column_names.push_back(ExpressionActions::getSmallestColumn(storage_snapshot_->metadata->getColumns().getAllPhysical()).name);
StorageView * view = dynamic_cast<StorageView *>(storage.get());
if (!view || allow_experimental_analyzer)
{
storage->read(plan,
real_column_names,
storage_snapshot_,
modified_query_info,
modified_context,
processed_stage,
max_block_size,
UInt32(streams_num));
}
else
{
/// For view storage, we need to rewrite the `modified_query_info.view_query` to optimize read.
/// The most intuitive way is to use InterpreterSelectQuery.
/// Intercept the settings
modified_context->setSetting("max_threads", streams_num);
modified_context->setSetting("max_streams_to_max_threads_ratio", 1);
modified_context->setSetting("max_block_size", max_block_size);
InterpreterSelectQuery interpreter(modified_query_info.query,
modified_context,
storage,
view->getInMemoryMetadataPtr(),
SelectQueryOptions(processed_stage));
interpreter.buildQueryPlan(plan);
}
storage->read(plan,
real_column_names,
storage_snapshot_,
modified_query_info,
modified_context,
processed_stage,
max_block_size,
UInt32(streams_num));
if (!plan.isInitialized())
return {};

View File

@ -7,6 +7,9 @@ Expression ((Projection + Before ORDER BY))
Aggregating
Expression (Before GROUP BY)
ReadFromMerge
ReadFromMergeTree (default.mt1)
ReadFromMergeTree (default.mt2)
ReadFromStorage (TinyLog)
Expression
ReadFromMergeTree (default.mt1)
Expression
ReadFromMergeTree (default.mt2)
Expression
ReadFromStorage (TinyLog)