Merge pull request #31679 from excitoon-favorites/fixmaterializecolumn

Fixed null pointer exception in `MATERIALIZE COLUMN`
This commit is contained in:
Maksim Kita 2021-11-24 12:29:23 +03:00 committed by GitHub
commit 527480bd8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -569,6 +569,11 @@ ASTPtr MutationsInterpreter::prepare(bool dry_run)
stages.emplace_back(context);
const auto & column = columns_desc.get(command.column_name);
if (column.default_desc.kind != ColumnDefaultKind::Materialized)
{
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Column {} could not be materialized", column.name);
}
stages.back().column_to_updated.emplace(column.name, column.default_desc.expression->clone());
}
else if (command.type == MutationCommand::MATERIALIZE_INDEX)