ClickHouse
ClickHouse copied to clipboard
default_temporary_table_engine = 'MergeTree' inherit keys when CREATE TEMPORARY TABLE ... AS ...
Use case
temporary tables used to prepare parts in some ETL process.
right now you CAN create another non-temporary table which will inerit / derive the ORDER BY & PARTITION BY from the original table.
create table test (a UInt8, b String, c Nullable(Float), date Date) Engine=MergeTree ORDER BY (a,b) PARTITION BY date;
CREATE TABLE test2 AS test; -- will have same engine, and keys as test
but you can't do the same with temporary table, when default_temporary_table_engine = 'MergeTree'
SET default_temporary_table_engine = 'MergeTree';
CREATE TEMPORARY TABLE test3 AS test; -- gives an exception NUMBER_OF_ARGUMENTS_DOESNT_MATCH requiring ORDER BY
Describe the solution you'd like
Just derive the necessary engine parameters from the source table.
Describe alternatives you've considered
CREATE TEMPORARY TABLE test3 ORDER BY (a,b) PARTITION BY date AS test;
That works but is not handy and error prone
Lucky issue number! This looks easy to implement...
I'd like to finish this lucky number.
@xiedeyantu, thank you, this will be very appreciated!
Any news from the lucky number issue ? @xiedeyantu @alexey-milovidov