Search code examples
sqlhivehdfshiveqlimpala

How Create a hive external table with parquet format


I am trying to create an external table in hive with the following query in HDFS.

CREATE EXTERNAL TABLE `post` (
    FileSK STRING,
    OriginalSK STRING,
    FileStatus STRING,
    TransactionType STRING,
    TransactionDate STRING
   )
  ROW FORMAT DELIMITED
  FIELDS TERMINATED BY ','
  STORED AS PARQUET TBLPROPERTIES("Parquet.compression"="SNAPPY")
  LOCATION 'hdfs://.../post'

getting error

Error while compiling statement: FAILED: ParseException line 11:2 missing EOF at 'LOCATION' near ')'

What is the best way to create a HIVE external table with data stored in parquet format?


Solution

  • I am able to create table after removing property TBLPROPERTIES("Parquet.compression"="SNAPPY")

    CREATE EXTERNAL TABLE `post` (
        FileSK STRING,
        OriginalSK STRING,
        FileStatus STRING,
        TransactionType STRING,
        TransactionDate STRING
       )
      ROW FORMAT DELIMITED
      FIELDS TERMINATED BY ','
      STORED AS PARQUET,
      LOCATION 'hdfs://.../post'