Reputation: 95
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:
Upvotes: 0
Views: 1332
Reputation: 44941
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");
Upvotes: 3