Newer versions can't clear columns which are used in default expressions for other columns. Maybe it's caused by https://github.com/ClickHouse/ClickHouse/issues/6913

CH version 20.5.2


create database Temp;
create table Temp.Test (`impression_id` String,`impression_id_compressed` FixedString(16) DEFAULT UUIDStringToNum(substring(impression_id, 1, 36)), `impression_id_hashed` UInt16 DEFAULT reinterpretAsUInt16(impression_id_compressed), `event_date` Date ) ENGINE = MergeTree(event_date, impression_id_hashed, (event_date, impression_id_hashed), 8192);
alter table Temp.Test clear column `impression_id` in partition '202001';


Received exception from server (version 20.5.2):
Code: 44. DB::Exception: Received from ch7r1.local:9000. DB::Exception: Cannot drop column `impression_id`, because column `impression_id_compressed` depends on it. 




Older versions (tested with 19.17.4 and 20.3.5):

CREATE DATABASE Temp;
create table Temp.Test (`impression_id` String,`impression_id_compressed` FixedString(16) DEFAULT UUIDStringToNum(substring(impression_id, 1, 36)), `impression_id_hashed` UInt16 DEFAULT reinterpretAsUInt16(impression_id_compressed), `event_date` Date ) ENGINE = MergeTree(event_date, impression_id_hashed, (event_date, impression_id_hashed), 8192);
alter table Temp.Test clear column `impression_id` in partition '202001';

ALTER TABLE Temp.Test
    CLEAR COLUMN impression_id     IN PARTITION '202001'


Ok.

auto next_command = (*this)[j];
               if (next_command.type == AlterCommand::RENAME_COLUMN)
               {
                   if (next_command.column_name == command.rename_to)
                       throw Exception{"Transitive renames in a single ALTER query are not allowed (don't make sense)",
                                                            ErrorCodes::NOT_IMPLEMENTED};
                   else if (next_command.column_name == command.column_name)
                       throw Exception{"Cannot rename column '" + backQuote(command.column_name)
                                           + "' to two different names in a single ALTER query",
                                       ErrorCodes::BAD_ARGUMENTS};
               }
           }
            
            if (all_columns.hasNested(command.column_name))
            {
                throw Exception{"Cannot rename whole Nested struct", ErrorCodes::NOT_IMPLEMENTED};
            }
            if (!all_columns.has(command.column_name))
            {
                if (!command.if_exists)
                    throw Exception{"Wrong column name. Cannot find column " + backQuote(command.column_name) + " to rename",
                                    ErrorCodes::NOT_FOUND_COLUMN_IN_BLOCK};
                else
                    continue;
            }
            if (all_columns.has(command.rename_to))
                throw Exception{"Cannot rename to " + backQuote(command.rename_to) + ": column with this name already exists",
                                ErrorCodes::DUPLICATE_COLUMN};
            if (modified_columns.count(column_name))
                throw Exception{"Cannot rename and modify the same column " + backQuote(column_name) + " in a single ALTER query",