Rani
Rani

Reputation: 119

remove quotes from fields while loading data into hive

I want to load a table with input data into hive. I have data in the following format.

100510;LOCAL CARD;;;;UNITED KINGDOM;GB;GBR;826
100515;LOCAL CARD;;;;NORWAY;NO;NOR;578
103753;LOCAL CARD;I&M BANK;DEBIT;PREPAID;KENYA;KE;KEN;404
104001;LOCAL CARD;LUXURY JEWELLERY CLASS (LJC) - TDFS;;;CANADA;CA;CAN;124

I want to load this table in hive from hdfs but because some columns do not contains data its giving me double quotes in results. I want to ignore them.

Upvotes: 0

Views: 2000

Answers (1)

Andrew
Andrew

Reputation: 8703

You can control how Hive handles nulls using serialization.null.format. To create a table:

create table <your table>
<column list>
rowformat delimited fields terminated by <your delimiter>
TBLPROPERTIES ('serialization.null.format' = '');

To change an existing table

alter table <your table>  set TBLPROPERTIES ('serialization.null.format' = '');

Upvotes: 1

Related Questions