One quick way to solve this is setting textinputformat.record.delimiter=”US”  
before reading from that text table.
But it has some limitations:
1,you cannot read multiple text tables with different line  delimiters in the 
same query.
2,you cannot write to that text table with your own line  delimiter.

Also ,there is patch at https://issues.apache.org/jira/browse/HIVE-5999  Allow 
other characters for LINES TERMINATED BY .
Which may meet your requirements.

From: Peter Vary [mailto:[email protected]]
Sent: Friday, June 03, 2016 1:29 AM
To: [email protected]
Subject: Re: LINES TERMINATED BY only supports newline '\n' right now


Hi,

According to the documentation you should write and set your own Inputformat 
when creating the table.

Mike Sukmanowsky solved a similar problem here, this might help you:
http://stackoverflow.com/questions/7692994/custom-inputformat-with-hive

Regards,
Peter
For some of the columns '\n' character is there as part of value, i want to 
create a hive table for this data i tried by creating the hive table with US as 
the line separator but it showing the below message

Ex:
CREATE EXTERNAL TABLE IF NOT EXISTS emp (name String,id int)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '28'
LINES TERMINATED BY '31'
LOCATION 'emp.txt file path';

FAILED: SemanticException 4:20 LINES TERMINATED BY only supports newline '\n' 
right now. Error encountered near token ''31''

how can we create hive table with out removing the \n character as part of 
column value ( requirement data need to maintain as it is)

can any one implemented hive tables with line separated other than \n

Thanks & Regards
   Radha krishna

Reply via email to