| 1054 | } |
| 1055 | |
| 1056 | void MergeTreeDataMutator::mutateAllPartColumns( |
| 1057 | MergeTreeData::MutableDataPartPtr new_data_part, |
| 1058 | const StorageMetadataPtr & metadata_snapshot, |
| 1059 | const MergeTreeIndices & skip_indices, |
| 1060 | const MergeTreeProjections & projections_to_build, |
| 1061 | const MutationCommands & commands_for_removes, |
| 1062 | BlockInputStreamPtr mutating_stream, |
| 1063 | time_t time_of_mutation, |
| 1064 | const CompressionCodecPtr & compression_codec, |
| 1065 | ManipulationListEntry & manipulation_entry, |
| 1066 | bool need_sync, |
| 1067 | const ReservationPtr & space_reservation, |
| 1068 | TableLockHolder & holder, |
| 1069 | ContextPtr context) |
| 1070 | { |
| 1071 | if (mutating_stream == nullptr) |
| 1072 | throw Exception("Cannot mutate part columns with uninitialized mutations stream. It's a bug", ErrorCodes::LOGICAL_ERROR); |
| 1073 | |
| 1074 | if (new_data_part->versions->enable_compact_map_data) |
| 1075 | { |
| 1076 | LOG_WARNING(log, "Try to mutate all columns to new part {} with compact map enabled, enable_compact_map_data" |
| 1077 | " will be forced to disable in new part.", new_data_part->name); |
| 1078 | |
| 1079 | new_data_part->versions->enable_compact_map_data = 0; |
| 1080 | } |
| 1081 | |
| 1082 | if (metadata_snapshot->hasPrimaryKey() || metadata_snapshot->hasSecondaryIndices()) |
| 1083 | mutating_stream = std::make_shared<MaterializingBlockInputStream>( |
| 1084 | std::make_shared<ExpressionBlockInputStream>(mutating_stream, data.getPrimaryKeyAndSkipIndicesExpression(metadata_snapshot))); |
| 1085 | |
| 1086 | IMergeTreeDataPart::MinMaxIndex minmax_idx; |
| 1087 | |
| 1088 | MergedBlockOutputStream out{ |
| 1089 | new_data_part, |
| 1090 | metadata_snapshot, |
| 1091 | new_data_part->getColumns(), |
| 1092 | skip_indices, |
| 1093 | compression_codec}; |
| 1094 | |
| 1095 | mutating_stream->readPrefix(); |
| 1096 | out.writePrefix(); |
| 1097 | |
| 1098 | writeWithProjections( |
| 1099 | new_data_part, |
| 1100 | metadata_snapshot, |
| 1101 | projections_to_build, |
| 1102 | mutating_stream, |
| 1103 | out, |
| 1104 | time_of_mutation, |
| 1105 | manipulation_entry, |
| 1106 | space_reservation, |
| 1107 | holder, |
| 1108 | context, |
| 1109 | &minmax_idx); |
| 1110 | |
| 1111 | new_data_part->minmax_idx = std::move(minmax_idx); |
| 1112 | mutating_stream->readSuffix(); |
| 1113 |
nothing calls this directly
no test coverage detected