From 074c2ead9c9031611de365c8c1c6ce66dd112037 Mon Sep 17 00:00:00 2001 From: Amos Bird Date: Tue, 11 May 2021 18:22:23 +0800 Subject: [PATCH] Fix --- src/Storages/MergeTree/MergeTreeData.cpp | 3 ++- src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Storages/MergeTree/MergeTreeData.cpp b/src/Storages/MergeTree/MergeTreeData.cpp index a125d001495..22fe540222e 100644 --- a/src/Storages/MergeTree/MergeTreeData.cpp +++ b/src/Storages/MergeTree/MergeTreeData.cpp @@ -732,8 +732,9 @@ Block MergeTreeData::getBlockWithVirtualPartColumns(const MergeTreeData::DataPar auto & part_uuid_column = columns[2]; auto & partition_value_column = columns[3]; - for (const auto & part : parts) + for (const auto & part_or_projection : parts) { + const auto * part = part_or_projection->isProjectionPart() ? part_or_projection->getParentPart() : part_or_projection.get(); part_column->insert(part->name); partition_id_column->insert(part->info.partition_id); part_uuid_column->insert(part->uuid); diff --git a/src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp b/src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp index 53e1440be29..562ac4d2b5a 100644 --- a/src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp +++ b/src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp @@ -196,7 +196,7 @@ QueryPlanPtr MergeTreeDataSelectExecutor::read( // NOTE: prewhere is executed inside readFromParts if (query_info.projection->before_where) { - LOG_DEBUG(log, "projection before_where: {}", query_info.projection->before_where->dumpDAG()); + // std::cerr << fmt::format("projection before_where: {}", query_info.projection->before_where->dumpDAG()); auto where_step = std::make_unique( plan->getCurrentDataStream(), query_info.projection->before_where, @@ -209,7 +209,7 @@ QueryPlanPtr MergeTreeDataSelectExecutor::read( if (query_info.projection->before_aggregation) { - LOG_DEBUG(log, "projection before_aggregation: {}", query_info.projection->before_aggregation->dumpDAG()); + // std::cerr << fmt::format("projection before_aggregation: {}", query_info.projection->before_aggregation->dumpDAG()); auto expression_before_aggregation = std::make_unique(plan->getCurrentDataStream(), query_info.projection->before_aggregation); expression_before_aggregation->setStepDescription("Before GROUP BY");