| 904 | } |
| 905 | |
| 906 | static void checkKeyExpression(const ExpressionActions & expr, const Block & sample_block, const String & key_name, bool allow_nullable_key) |
| 907 | { |
| 908 | if (expr.hasArrayJoin()) |
| 909 | throw Exception(ErrorCodes::ILLEGAL_COLUMN, "{} key cannot contain array joins", key_name); |
| 910 | |
| 911 | try |
| 912 | { |
| 913 | expr.assertDeterministic(); |
| 914 | } |
| 915 | catch (Exception & e) |
| 916 | { |
| 917 | e.addMessage(fmt::format("for {} key", key_name)); |
| 918 | throw; |
| 919 | } |
| 920 | |
| 921 | for (const ColumnWithTypeAndName & element : sample_block) |
| 922 | { |
| 923 | const ColumnPtr & column = element.column; |
| 924 | if (column && (isColumnConst(*column) || column->isDummy())) |
| 925 | throw Exception(ErrorCodes::ILLEGAL_COLUMN, "{} key cannot contain constants", key_name); |
| 926 | |
| 927 | if (!allow_nullable_key && hasNullable(element.type)) |
| 928 | throw Exception( |
| 929 | ErrorCodes::ILLEGAL_COLUMN, |
| 930 | "{} key contains nullable columns, " |
| 931 | "but merge tree setting `allow_nullable_key` is disabled", key_name); |
| 932 | } |
| 933 | } |
| 934 | |
| 935 | void MergeTreeData::checkProperties( |
| 936 | const StorageInMemoryMetadata & new_metadata, |
no test coverage detected