MergeTree mutations reuse source part index granularity

This commit is contained in:
Maksim Kita 2023-11-29 12:35:16 +03:00
parent 4c0efb0262
commit f0e53fde64
3 changed files with 7 additions and 4 deletions

View File

@ -24,7 +24,8 @@ MergedBlockOutputStream::MergedBlockOutputStream(
const MergeTreeTransactionPtr & txn,
bool reset_columns_,
bool blocks_are_granules_size,
const WriteSettings & write_settings_)
const WriteSettings & write_settings_,
const MergeTreeIndexGranularity & computed_index_granularity)
: IMergedBlockOutputStream(data_part, metadata_snapshot_, columns_list_, reset_columns_)
, columns_list(columns_list_)
, default_codec(default_codec_)
@ -48,7 +49,7 @@ MergedBlockOutputStream::MergedBlockOutputStream(
data_part->version.setCreationTID(tid, nullptr);
data_part->storeVersionMetadata();
writer = data_part->getWriter(columns_list, metadata_snapshot, skip_indices, statistics, default_codec, writer_settings, {});
writer = data_part->getWriter(columns_list, metadata_snapshot, skip_indices, statistics, default_codec, writer_settings, computed_index_granularity);
}
/// If data is pre-sorted.

View File

@ -25,7 +25,8 @@ public:
const MergeTreeTransactionPtr & txn,
bool reset_columns_ = false,
bool blocks_are_granules_size = false,
const WriteSettings & write_settings = {});
const WriteSettings & write_settings = {},
const MergeTreeIndexGranularity & computed_index_granularity = {});
Block getHeader() const { return metadata_snapshot->getSampleBlock(); }

View File

@ -1535,7 +1535,8 @@ private:
ctx->txn,
/*reset_columns=*/ true,
/*blocks_are_granules_size=*/ false,
ctx->context->getWriteSettings());
ctx->context->getWriteSettings(),
ctx->source_part->index_granularity);
ctx->mutating_pipeline = QueryPipelineBuilder::getPipeline(std::move(builder));
ctx->mutating_pipeline.setProgressCallback(ctx->progress_callback);