hiveddlcreate-tablehive-serdehiveddl

Cloudera Hue - cannot recognize input near 'WITH' 'SERDEPROPERTIES' '(' in serde properties specification


I'm trying to create this table:

CREATE TABLE
    TABLE_DATA
    (
        A STRING,
        B STRING,
        C STRING,
        D STRING,
        E STRING,
        F STRING,
        G STRING,
        H STRING,
    )
    ROW FORMAT DELIMITED FIELDS TERMINATED BY ','
    ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde'
    WITH SERDEPROPERTIES 
    (
       "separatorChar" = ",",
       "quoteChar"     = "\""
    )       
    STORED AS TEXTFILE LOCATION '...'
    TBLPROPERTIES ("skip.header.line.count"="1");

However I'm getting an issue:

Error while compiling statement: FAILED: ParseException line 14:2 cannot recognize input near 'WITH' 'SERDEPROPERTIES' '(' in serde properties specification

How can I solve it?

Thanks!


Solution

  • ROW FORMAT should be specified once, and remove extra comma after last column

    CREATE TABLE TABLE_DATA
                (
                        A STRING,
                        B STRING,
                        C STRING,
                        D STRING,
                        E STRING,
                        F STRING,
                        G STRING,
                        H STRING
                )
                ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde'
                WITH SERDEPROPERTIES 
                (
                   "separatorChar" = ",",
                   "quoteChar"     = "\""
                )       
                LOCATION '...'
                TBLPROPERTIES ("skip.header.line.count"="1");