You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Column ALIAS should not allow codec
Alias column (as a non-materialized one) should probably not allow adding codec
How to reproduce
server version: ClickHouse server version 22.12.3 revision 54461.
client: ClickHouse client version 22.12.3.5 (official build).
Non-default settings: seems none relevant
Sample data - unnecessary
Queries to run:
create database if not exists tmp;
create table if not exists tmp.alias_column_should_not_allow_compression ( user_id UUID, user_id_hashed ALIAS (cityHash64(user_id)))
engine MergeTree
partition by tuple()
order by tuple()
;
/* -- generate alters
select --name, type,
'alter table '|| database || '.' || table || ' modify column `' || name || '` ' || type || ' codec(LZ4HC(1));'
from system.columns where database = 'tmp' and table = 'alias_column_should_not_allow_compression' and compression_codec = ''
;
*/
alter table tmp.alias_column_should_not_allow_compression modify column `user_id_hashed` UInt64 codec(LZ4HC(1));
-- performed ok, though I understand that it makes no sense for alias - missed in bulk operation and no possibility to override on table's MergeTree settings level for default
detach table tmp.alias_column_should_not_allow_compression;
attach table tmp.alias_column_should_not_allow_compression;
-- throws error (same for server restart - loops daemon startup)
-- Received exception from server (version 22.12.3):
-- Code: 36. DB::Exception: Received from localhost:9000. DB::Exception: Cannot specify codec for column type ALIAS. (BAD_ARGUMENTS)
Expected behavior
I suppose best here - is to throw on alter attempt (but disregard of codec on attach/operation of alias column is an option as well)
Additional context
-- 1 - how to drop table in such situation? or remove replica?
drop table tmp.alias_column_should_not_allow_compression;
-- returns
-- Received exception from server (version 22.12.3):
-- Code: 60. DB::Exception: Received from localhost:9000. DB::Exception: Table tmp.alias_column_should_not_allow_compression doesn't exist. (UNKNOWN_TABLE)
create or replace table tmp.alias_column_should_not_allow_compression ( user_id UUID, user_id_hashed ALIAS (cityHash64(user_id)))
engine MergeTree
partition by tuple()
order by tuple()
;
-- returns:
-- Received exception from server (version 22.12.3):
-- Code: 57. DB::Exception: Received from localhost:9000. DB::Exception: Table `tmp`.`alias_column_should_not_allow_compression` already exists (detached). (TABLE_ALREADY_EXISTS)
replace table tmp.alias_column_should_not_allow_compression ( user_id UUID, user_id_hashed ALIAS (cityHash64(user_id)))
engine MergeTree
partition by tuple()
order by tuple()
;
-- returns:
-- Received exception from server (version 22.12.3):
-- Code: 60. DB::Exception: Received from localhost:9000. DB::Exception: Table `tmp`.`alias_column_should_not_allow_compression` doesn't exist. (UNKNOWN_TABLE)
-- *if there is a way do it by SQL - please let me know (we resolved only via manipulations with ZK and afterwadrs restore of replica)
-- 2 - exception readability
create table if not exists tmp.alias_column_should_not_allow_compression_2 ( user_id UUID, user_id_hashed ALIAS (cityHash64(user_id)))
engine MergeTree
partition by tuple()
order by tuple()
;
alter table tmp.alias_column_should_not_allow_compression_2 modify column if exists `user_id_hashed` remove CODEC;
-- if column has no codec - throws: ...doesn't have TTL ... - may be would be better readable if parametrized like ...doesn't have {item_property_to_remove}...
-- Received exception from server (version 22.12.3):
-- Code: 36. DB::Exception: Received from localhost:9000. DB::Exception: Column `user_id_hashed` doesn't have TTL, cannot remove it. (BAD_ARGUMENTS)
The text was updated successfully, but these errors were encountered:
Column ALIAS should not allow codec
Alias column (as a non-materialized one) should probably not allow adding codec
How to reproduce
Expected behavior
I suppose best here - is to throw on alter attempt (but disregard of codec on attach/operation of alias column is an option as well)
Additional context
The text was updated successfully, but these errors were encountered: