Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

Hive external table with semicolon delimiter

avatar
New Member

EDIT: FIELDS TERMINATED BY '\u0059' WORKS

I am trying to create an external table from a csv file with ; as delimiter. I have tried

FIELDS TERMINATED BY ';'

FIELDS TERMINATED BY '\;'

FIELDS TERMINATED BY '\\;'

Modifying the data is not an option.

This is the hive script:

CREATE EXTERNAL TABLE table1(
	f STRING
)
COMMENT 'table 1'
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\;'
STORED AS TEXTFILE
LOCATION '/path/to/hdfs/'
tblproperties ("skip.header.line.count"="1");

I get the following error, in all cases:

Error while compiling statement: FAILED: ParseException line 72:23 mismatched input '<EOF>' expecting StringLiteral near 'BY' in table row format's field separator [ERROR_STATUS]
1 ACCEPTED SOLUTION

avatar
New Member

Nevermind: this does work

FIELDS TERMINATED BY '\u0059'

View solution in original post

4 REPLIES 4

avatar
New Member

Nevermind: this does work

FIELDS TERMINATED BY '\u0059'

avatar
New Member

Check this,

FIELDS TERMINATED BY ';'

avatar
New Member

This is exactly what is causing the error.... Hive thinks the ; ends the statement, despite the quotes

avatar
New Member
According to the latest StackOverflow post, it should be:

FIELDS TERMINATED BY '\u003B'