简体   繁体   中英

Presto Hive SQL Error: mismatched input 'PARTITIONED'. Expecting: 'COMMENT', 'WITH', <EOF>

I am trying to create a Hive table with partitions but getting the above error. What am I doing wrong?

CREATE TABLE IF NOT EXISTS schema.table_name
    (
    ID   varchar(20),
    name varchar(50)
    )
PARTITIONED BY (part_dt varchar(8), system varchar(5));

The code works without the partitioning clause. Something gives up during partitioning.

Statement is working in hive. Pls find below screenshot. SC Its possible that some of column names are reserved keywords and that is throwing error. if yes, you can use below SQL too.

CREATE TABLE IF NOT EXISTS schema.table_name
    (
    `ID`   varchar(20),
    `name` varchar(50)
    )
PARTITIONED BY (`part_dt` varchar(8), `system` varchar(5));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM