Use original_query for projection analysis

This commit is contained in:
Amos Bird 2021-10-19 22:09:43 +08:00
parent 240895fba7
commit 2f615e9176
No known key found for this signature in database
GPG Key ID: 80D430DCBECFEDB4
3 changed files with 3 additions and 1 deletions

View File

@ -272,6 +272,7 @@ InterpreterSelectQuery::InterpreterSelectQuery(
query_info.ignore_projections = options.ignore_projections;
query_info.is_projection_query = options.is_projection_query;
query_info.original_query = query_ptr->clone();
initSettings();
const Settings & settings = context->getSettingsRef();

View File

@ -4531,7 +4531,7 @@ bool MergeTreeData::getQueryProcessingStageWithAggregateProjection(
if (!settings.allow_experimental_projection_optimization || query_info.ignore_projections || query_info.is_projection_query)
return false;
const auto & query_ptr = query_info.query;
const auto & query_ptr = query_info.original_query;
if (auto * select = query_ptr->as<ASTSelectQuery>(); select)
{

View File

@ -133,6 +133,7 @@ struct SelectQueryInfo
{
ASTPtr query;
ASTPtr view_query; /// Optimized VIEW query
ASTPtr original_query; /// Unmodified query for projection analysis
/// Cluster for the query.
ClusterPtr cluster;