Hive error: parseexception missing EOF Hive error: parseexception missing EOF hadoop hadoop

Hive error: parseexception missing EOF


Try put the "LOCATION" in front of "tblproperties" like below, worked for me.

CREATE TABLE default.testtbl(int1 INT,string1 STRING)    stored as orc   LOCATION "/user/hive/test_table"  tblproperties ("orc.compress"="NONE");

It seems even the sample SQL from book "Programming Hive" got the order wrong. Please reference to the official definition of create table command:

https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-CreateTable


@Haiying Wang pointed out that LOCATION is to be put in front of tblproperties.

But I think the error also occurs when location is specified above stored as.

Its better to stick to the correct order:

CREATE [TEMPORARY] [EXTERNAL] TABLE [IF NOT EXISTS] [db_name.]table_name    -- (Note: TEMPORARY available in Hive 0.14.0 and later)  [(col_name data_type [COMMENT col_comment], ... [constraint_specification])]  [COMMENT table_comment]  [PARTITIONED BY (col_name data_type [COMMENT col_comment], ...)]  [CLUSTERED BY (col_name, col_name, ...) [SORTED BY (col_name [ASC|DESC], ...)] INTO num_buckets BUCKETS]  [SKEWED BY (col_name, col_name, ...)                  -- (Note: Available in Hive 0.10.0 and later)]     ON ((col_value, col_value, ...), (col_value, col_value, ...), ...)     [STORED AS DIRECTORIES]  [   [ROW FORMAT row_format]    [STORED AS file_format]     | STORED BY 'storage.handler.class.name' [WITH SERDEPROPERTIES (...)]  -- (Note: Available in Hive 0.6.0 and later)  ]  [LOCATION hdfs_path]  [TBLPROPERTIES (property_name=property_value, ...)]   -- (Note: Available in Hive 0.6.0 and later)  [AS select_statement];   -- (Note: Available in Hive 0.5.0 and later; not supported for external tables)

Refer: Hive Create Table


Check this post:

Loading Data from a .txt file to Table Stored as ORC in Hive

And check your source files present at the specified directory /user/hive/test_table. Incase the files are in .txt or some other non ORC format then you can follow the steps in the above post to come out of the error.