| 505 | } |
| 506 | |
| 507 | NameSet MergeTreeDataMutator::collectFilesForClearMapKey(MergeTreeData::DataPartPtr source_part, const MutationCommands & commands) |
| 508 | { |
| 509 | NameSet clear_map_key_set; |
| 510 | const auto & metadata_snapshot = source_part->storage.getInMemoryMetadata(); |
| 511 | for (const auto & command : commands) |
| 512 | { |
| 513 | if (command.type != MutationCommand::Type::CLEAR_MAP_KEY) |
| 514 | continue; |
| 515 | |
| 516 | /// Collect all file names of the implicit key name. |
| 517 | NameSet file_set; |
| 518 | |
| 519 | String map_name = command.column_name; |
| 520 | const auto & map_column = metadata_snapshot.columns.getPhysical(map_name); |
| 521 | const auto & map_type = typeid_cast<const DataTypeMap &>(*map_column.type); |
| 522 | /// Remove all files of the implicit key name |
| 523 | for (const auto & map_key_ast : command.map_keys->children) |
| 524 | { |
| 525 | const auto * key_lit = map_key_ast->as<ASTLiteral>(); |
| 526 | String key_name = convertToMapKeyString(map_type.getKeyType(), key_lit->getColumnName()); |
| 527 | |
| 528 | for (const auto & [file, _] : source_part->getChecksums()->files) |
| 529 | { |
| 530 | if (isMapBaseFile(file)) |
| 531 | continue; |
| 532 | if (isMapImplicitFileNameOfSpecialMapName(file, map_name) && parseKeyNameFromImplicitFileName(file, map_name) == key_name) |
| 533 | clear_map_key_set.emplace(file); |
| 534 | } |
| 535 | } |
| 536 | } |
| 537 | return clear_map_key_set; |
| 538 | } |
| 539 | |
| 540 | |
| 541 | NameToNameVector MergeTreeDataMutator::collectFilesForRenames( |
nothing calls this directly
no test coverage detected