0
votes

First of all I have created the table "emp" in Hive by using below commands:

create table emp (id INT, name STRING, address STRING)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\t';

Then load the data in this "emp" table by this below command: LOAD DATA LOCAL INPATH '\home\cloudera\Desktop\emp.txt' overwrite into table emp;

When I select the data from "emp" table: it show me first field of table Null like this:

enter image description here

1
Can you share the emp.txt file? - piyush pankaj
its a tab Delimited file. "id" "Name" "Address" these are the fields. it show "ID" Fields NULL - Mudi
Are you adding "" to data in ur file ? - piyush pankaj
No, I was not using "" in my file. Just put the "Column" name and the data for those "column" - Mudi
P.s. please replace the picture with text (format it with ctrl+k) - David דודו Markovitz

1 Answers

3
votes

You have an header row in your file and the first value id cannot be converted into INT therefore being replaced by NULL.

add tblproperties ("skip.header.line.count"="1") to your table definition

For an existing table -

alter table emp set tblproperties ("skip.header.line.count"="1");