0

I'm trying to load CSV file to Hive table and my file contains '\n' - carriage return symbols inside some text columns.

Is there an easy way to import this to Hive? I know I can write custom format for this, but possibly there is easier way?

UPDATED

sample data (CSV) 2 lines:

"1","title","some text","more detailed text \n with some carriage returns\n\n\n"
"2","title2","some text2","more detailed text2222 \n with some carriage returns\n\n\n"

schema:

CREATE EXTERNAL TABLE train (
    id BIGINT, title string, content string, details string
)

Any help will be much appreciated. Thanks.

Maxim Galushka
  • 397
  • 1
  • 5
  • 22

1 Answers1

0

step 1. replace \n with some character using tr or sed in local file

cat filename|tr "\n" " " >>new_filename.csv

step 2 create table in hive using create statement

Community
  • 1
  • 1
Balaswamy Vaddeman
  • 8,360
  • 3
  • 30
  • 40