Skip to content

create table failed with partition #5167

Answered by killme2008
amythos asked this question in Q&A
Discussion options

You must be logged in to vote

@amythos

The second rule is wrong:

 ts >= '2025-01-01 00:00:00' AND ts < '2010-01-01 00:00:00',

It should be:

    ts >= '2005-01-01 00:00:00' AND ts < '2010-01-01 00:00:00',

The complete SQL:

CREATE TABLE IF NOT EXISTS tbl_aaa (
   ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
   code STRING NOT NULL,
    amount DOUBLE,
    PRIMARY KEY(code),
    TIME INDEX(ts)
)
PARTITION ON COLUMNS (ts) (
    ts < '2005-01-01 00:00:00',
    ts >= '2005-01-01 00:00:00' AND ts < '2010-01-01 00:00:00',
    ts >= '2010-01-01 00:00:00' AND ts < '2015-01-01 00:00:00',
    ts >= '2015-01-01 00:00:00' AND ts < '2020-01-01 00:00:00',
    ts >= '2020-01-01 00:00:00' AND ts < '2025-01-01 00:00:00',
    ts >= '2025-01-…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@amythos
Comment options

Answer selected by amythos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants