Details
-
New Feature
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
-
ghx-label-7
Description
As a devop I would like to have scripts that create tables for me.
Many times when creating tables the partitioning is dependent on calculated values, mainly time stamps.
Currently we need to alter the script manually for every deployment
CREATE TABLE dwh.f_events (
ts BIGINT,
batch_id STRING,
network_id INT,
...
last_updated BIGINT,
PRIMARY KEY (ts,batch_id,network_id)
)
PARTITION BY HASH (network_id) PARTITIONS 8,
RANGE (ts)
(
PARTITION 1524528000000 <= VALUES < 1524614400000
)
STORED AS KUDU
It would be lovely if we could set the ranges with an expression as below (for 7 days partitions starting today)
CREATE TABLE dwh.f_events (
ts BIGINT,
batch_id STRING,
network_id INT,
...
last_updated BIGINT,
PRIMARY KEY (ts,batch_id,network_id)
)
PARTITION BY HASH (network_id) PARTITIONS 8,
RANGE (ts)
(
PARTITION (unix_timestamp() - (unix_timestamp() % (3600*24) ))*1000) <= VALUES < ((unix_timestamp() - (unix_timestamp() % (3600*24) ))*1000 + (3600000*24*7)))
STORED AS KUDU