ClickHouse does not like empty columns in a part

Created on 27 Nov 2019  Â·  2Comments  Â·  Source: ClickHouse/ClickHouse

:) create table t (a Int, b Int) engine = MergeTree order by tuple() partition by tuple();
:) insert into t values (1,2)
:) alter table t drop column b
:) alter table t add column b Int
:) alter table t drop column a
:) alter table t add column a Int

:) select * from t

SELECT *
FROM t

Received exception from server (version 19.18.1):
Code: 49. DB::Exception: Received from localhost:9000. DB::Exception: Could not find a column of minimum size in MergeTree, part /var/lib/clickhouse/data/default/t/all_1_1_0/. 

0 rows in set. Elapsed: 0.002 sec. 
bug easy task prio-minor

Most helpful comment

CREATE TABLE aaaa ENGINE = MergeTree ORDER BY tuple() AS SELECT * FROM numbers(100)

Ok.
0 rows in set. Elapsed: 0.015 sec. 


ALTER TABLE aaaa  DROP COLUMN number

Received exception from server (version 19.15.1):
Code: 90. DB::Exception: Received from localhost:9000. DB::Exception: Empty list of columns passed. 
0 rows in set. Elapsed: 0.012 sec. 

SHOW CREATE TABLE aaaa

Received exception from server (version 19.15.1):
Code: 62. DB::Exception: Received from localhost:9000. DB::Exception: Syntax error (in file /var/lib/clickhouse/metadata/default/aaaa.sql): failed at position 21 (line 3, col 1): )
ENGINE = MergeTree
ORDER BY tuple()
SETTINGS index_granularity = 8192
. Expected one of: table propery (column, index, constraint) declaration, columns or indices declaration list, column declaration, INDEX, CONSTRAINT, identifier, list of elements. 

0 rows in set. Elapsed: 0.005 sec. 


➜ sudo cat /var/lib/clickhouse/metadata/default/aaaa.sql
ATTACH TABLE aaaa
(
)
ENGINE = MergeTree
ORDER BY tuple()
SETTINGS index_granularity = 8192

:joy_cat:

All 2 comments

related #6913

CREATE TABLE aaaa ENGINE = MergeTree ORDER BY tuple() AS SELECT * FROM numbers(100)

Ok.
0 rows in set. Elapsed: 0.015 sec. 


ALTER TABLE aaaa  DROP COLUMN number

Received exception from server (version 19.15.1):
Code: 90. DB::Exception: Received from localhost:9000. DB::Exception: Empty list of columns passed. 
0 rows in set. Elapsed: 0.012 sec. 

SHOW CREATE TABLE aaaa

Received exception from server (version 19.15.1):
Code: 62. DB::Exception: Received from localhost:9000. DB::Exception: Syntax error (in file /var/lib/clickhouse/metadata/default/aaaa.sql): failed at position 21 (line 3, col 1): )
ENGINE = MergeTree
ORDER BY tuple()
SETTINGS index_granularity = 8192
. Expected one of: table propery (column, index, constraint) declaration, columns or indices declaration list, column declaration, INDEX, CONSTRAINT, identifier, list of elements. 

0 rows in set. Elapsed: 0.005 sec. 


➜ sudo cat /var/lib/clickhouse/metadata/default/aaaa.sql
ATTACH TABLE aaaa
(
)
ENGINE = MergeTree
ORDER BY tuple()
SETTINGS index_granularity = 8192

:joy_cat:

Was this page helpful?
0 / 5 - 0 ratings