Support Questions

Find answers, ask questions, and share your expertise

Skipping Headers in Hive

avatar
New Contributor

Hi Guys,

 

I am facing a problem with hive, while loading  data from local unix/linux filesystem  to hive table.

unix/linux filesystem having header as column names, i have to skip the header while loading data from unix/linux file system to hive.

 

can any one suggest me how to solve this issue..

 

Thanks in Advance,

 

 

 

1 REPLY 1

avatar
Mentor
Hive provides a skip header/footer feature when creating your table (as part of table properties). See the release notes on https://issues.apache.org/jira/browse/HIVE-5795

"""
CREATE TABLE testtable (name STRING, message STRING) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' TBLPROPERTIES ("skip.header.line.count"="1");

LOAD DATA LOCAL INPATH '/tmp/header-inclusive-file.csv' INTO TABLE testtable;
"""