Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Hive external table with semicolon delimiter

avatar
Explorer

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
Explorer

Nevermind: this does work

FIELDS TERMINATED BY '\u0059'

View solution in original post

4 REPLIES 4

avatar
Explorer

Nevermind: this does work

FIELDS TERMINATED BY '\u0059'

avatar
Contributor

Check this,

FIELDS TERMINATED BY ';'

avatar
Explorer

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

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

FIELDS TERMINATED BY '\u003B'