Skip to content

Commit b451bd5

Browse files
authored
Merge pull request ClickHouse#79234 from jsc0218/simplify_lwd_projection_drop_logic
Simplify projection lwd logic a bit
2 parents 26c958f + 2fa41d2 commit b451bd5

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/Storages/MergeTree/MutateTask.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ static NameSet collectFilesToSkip(
703703
const Block & updated_header,
704704
const std::set<MergeTreeIndexPtr> & indices_to_recalc,
705705
const String & mrk_extension,
706-
const std::set<ProjectionDescriptionRawPtr> & projections_to_skip,
706+
const std::vector<ProjectionDescriptionRawPtr> & projections_to_skip,
707707
const std::set<ColumnStatisticsPartPtr> & stats_to_recalc)
708708
{
709709
NameSet files_to_skip = source_part->getFileNamesWithoutChecksums();
@@ -2441,8 +2441,7 @@ bool MutateTask::prepare()
24412441
lightweight_mutation_projection_mode == LightweightMutationProjectionMode::DROP
24422442
|| lightweight_mutation_projection_mode == LightweightMutationProjectionMode::THROW;
24432443

2444-
std::set<ProjectionDescriptionRawPtr> projections_to_skip_container;
2445-
auto * projections_to_skip = &projections_to_skip_container;
2444+
std::vector<ProjectionDescriptionRawPtr> projections_to_skip;
24462445

24472446
bool should_create_projections = !(lightweight_delete_mode && lightweight_delete_drops_projections);
24482447
/// Under lightweight delete mode, if option is drop, projections_to_recalc should be empty.
@@ -2453,12 +2452,12 @@ bool MutateTask::prepare()
24532452
ctx->metadata_snapshot,
24542453
ctx->materialized_projections);
24552454

2456-
projections_to_skip = &ctx->projections_to_recalc;
2455+
projections_to_skip.assign(ctx->projections_to_recalc.begin(), ctx->projections_to_recalc.end());
24572456
}
24582457
else
24592458
{
24602459
for (const auto & projection : ctx->metadata_snapshot->getProjections())
2461-
projections_to_skip->insert(&projection);
2460+
projections_to_skip.emplace_back(&projection);
24622461
}
24632462

24642463
ctx->stats_to_recalc = MutationHelpers::getStatisticsToRecalculate(ctx->metadata_snapshot, ctx->materialized_statistics);
@@ -2469,7 +2468,7 @@ bool MutateTask::prepare()
24692468
ctx->updated_header,
24702469
ctx->indices_to_recalc,
24712470
ctx->mrk_extension,
2472-
*projections_to_skip,
2471+
projections_to_skip,
24732472
ctx->stats_to_recalc);
24742473

24752474
ctx->files_to_rename = MutationHelpers::collectFilesForRenames(

0 commit comments

Comments
 (0)