Load CSV File in HIVE skipping Header

Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
  • User AvatarANKUSH THAVALI
  • 17 Dec, 2021
  • 0 Comments
  • 47 Secs Read

Load CSV File in HIVE skipping Header

Download Sample Data

Sample Data

Create hive table and see data contain header

CREATE EXTERNAL TABLE IF NOT EXISTS header.tablewithheader
(id int,
first_name STRING,
last_name STRING,
email STRING,
gender STRING,
ip_address STRING)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '|'
STORED AS TEXTFILE
LOCATION 'hdfs://localhost:9000/user/hive/input/tablewithheader/';

Load data to hive table and see data has header


load data local inpath 'header_usersdata.csv' into table header.tablewithheader;

Create table with header properties

CREATE EXTERNAL TABLE IF NOT EXISTS header.rmhdr
(id int,
first_name STRING,
last_name STRING,
email STRING,
gender STRING,
ip_address STRING)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '|'
STORED AS TEXTFILE
LOCATION 'hdfs://localhost:9000/user/hive/input/rmhdr/'
TBLPROPERTIES("skip.header.line.count"="2");

Load data into hive table. header will not loaded to hive table


load data local inpath 'header_usersdata.csv' into table header.rmhdr;