| 3056 | } |
| 3057 | |
| 3058 | IStorage::DataValidationTasksPtr StorageMergeTree::getCheckTaskList( |
| 3059 | const std::variant<std::monostate, ASTPtr, String> & check_task_filter, ContextPtr local_context) |
| 3060 | { |
| 3061 | /// TODO(unique-key): sidecar-aware check. The per-part delete-bitmap |
| 3062 | /// sidecars are not enumerated as part artifacts, so checkDataPart treats |
| 3063 | /// them as UNEXPECTED_FILE_IN_DATA_PART. Reject for now. |
| 3064 | if (auto uk_metadata = getInMemoryMetadataPtr(local_context, false); uk_metadata && uk_metadata->hasUniqueKey()) |
| 3065 | throw Exception(ErrorCodes::SUPPORT_IS_DISABLED, |
| 3066 | "CHECK TABLE is not supported for UNIQUE KEY tables yet: delete-bitmap " |
| 3067 | "sidecars are not yet recognized as part artifacts."); |
| 3068 | |
| 3069 | DataPartsVector data_parts; |
| 3070 | if (const auto * partition_opt = std::get_if<ASTPtr>(&check_task_filter)) |
| 3071 | { |
| 3072 | const auto & partition = *partition_opt; |
| 3073 | if (!partition->as<ASTPartition>()) |
| 3074 | throw Exception(ErrorCodes::LOGICAL_ERROR, "Expected partition, got {}", partition->formatForErrorMessage()); |
| 3075 | String partition_id = getPartitionIDFromQuery(partition, local_context); |
| 3076 | data_parts = getVisibleDataPartsVectorInPartition(local_context, partition_id); |
| 3077 | } |
| 3078 | else if (const auto * part_name = std::get_if<String>(&check_task_filter)) |
| 3079 | { |
| 3080 | auto part = getPartIfExists(*part_name, {MergeTreeDataPartState::Active, MergeTreeDataPartState::Outdated}); |
| 3081 | if (!part) |
| 3082 | throw Exception(ErrorCodes::NO_SUCH_DATA_PART, "No such data part '{}' to check in table '{}'", |
| 3083 | *part_name, getStorageID().getFullTableName()); |
| 3084 | data_parts.emplace_back(std::move(part)); |
| 3085 | } |
| 3086 | else |
| 3087 | data_parts = getVisibleDataPartsVector(local_context); |
| 3088 | |
| 3089 | return std::make_unique<DataValidationTasks>(std::move(data_parts), local_context); |
| 3090 | } |
| 3091 | |
| 3092 | std::optional<CheckResult> StorageMergeTree::checkDataNext(DataValidationTasksPtr & check_task_list) |
| 3093 | { |
nothing calls this directly
no test coverage detected