Fix projection match

This commit is contained in:
Amos Bird 2021-07-31 15:44:16 +08:00
parent 9bdd9c912e
commit cd302eacc1
No known key found for this signature in database
GPG Key ID: 80D430DCBECFEDB4

View File

@ -4122,7 +4122,8 @@ bool MergeTreeData::getQueryProcessingStageWithAggregateProjection(
candidate.before_aggregation = analysis_result.before_aggregation->clone();
auto required_columns = candidate.before_aggregation->foldActionsByProjection(keys, projection.sample_block_for_keys);
if (required_columns.empty() && !keys.empty())
// TODO Let's find out the exact required_columns for keys.
if (required_columns.empty() && (!keys.empty() && !candidate.before_aggregation->getRequiredColumns().empty()))
continue;
if (analysis_result.optimize_aggregation_in_order)