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.

}
                else
                {
                    const auto & final_column_name = column_name;
                    const auto tmp_column_name = final_column_name + "_tmp";
                    const auto data_type_ptr = command.data_type;
                    default_expr_list->children.emplace_back(setAlias(
                        addTypeConversionToAST(std::make_shared<ASTIdentifier>(tmp_column_name), data_type_ptr->getName()),
                        final_column_name));
                    default_expr_list->children.emplace_back(setAlias(command.default_expression->clone(), tmp_column_name));
                }
            } 
            else if (all_columns.has(column_name) && command.data_type)
            {
                auto column_in_table = all_columns.get(column_name);
                
                if (!column_in_table.default_desc.expression)
                    continue;
                const auto & final_column_name = column_name;
                const auto tmp_column_name = final_column_name + "_tmp";
                const auto data_type_ptr = command.data_type;
                default_expr_list->children.emplace_back(setAlias(
                    addTypeConversionToAST(std::make_shared<ASTIdentifier>(tmp_column_name), data_type_ptr->getName()), final_column_name));
                default_expr_list->children.emplace_back(setAlias(column_in_table.default_desc.expression->clone(), tmp_column_name));
            }
        }
    }
    validateColumnsDefaultsAndGetSampleBlock(default_expr_list, all_columns.getAll(), context);
}
bool AlterCommands::isModifyingData(const StorageInMemoryMetadata & metadata) const