| 203 | } |
| 204 | |
| 205 | static void checkKeyExpression(const ExpressionActions & expr, const Block & sample_block, const String & key_name, bool allow_nullable_key) |
| 206 | { |
| 207 | for (const auto & action : expr.getActions()) |
| 208 | { |
| 209 | if (action.node->type == ActionsDAG::ActionType::ARRAY_JOIN) |
| 210 | throw Exception(key_name + " key cannot contain array joins", ErrorCodes::ILLEGAL_COLUMN); |
| 211 | |
| 212 | if (action.node->type == ActionsDAG::ActionType::FUNCTION) |
| 213 | { |
| 214 | IFunctionBase & func = *action.node->function_base; |
| 215 | if (!func.isDeterministic()) |
| 216 | throw Exception(key_name + " key cannot contain non-deterministic functions, " |
| 217 | "but contains function " + func.getName(), |
| 218 | ErrorCodes::BAD_ARGUMENTS); |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | for (const ColumnWithTypeAndName & element : sample_block) |
| 223 | { |
| 224 | const ColumnPtr & column = element.column; |
| 225 | if (column && (isColumnConst(*column) || column->isDummy())) |
| 226 | throw Exception{key_name + " key cannot contain constants", ErrorCodes::ILLEGAL_COLUMN}; |
| 227 | |
| 228 | if (!allow_nullable_key && element.type->isNullable()) |
| 229 | throw Exception{key_name + " key cannot contain nullable columns", ErrorCodes::ILLEGAL_COLUMN}; |
| 230 | } |
| 231 | } |
| 232 | |
| 233 | void MergeTreeMetaBase::checkProperties( |
| 234 | const StorageInMemoryMetadata & new_metadata, const StorageInMemoryMetadata & old_metadata, bool attach) const |
no test coverage detected