在 hive 表中加载时跳过 csv 的第一行 [英] Skip first line of csv while loading in hive table
本文介绍了在 hive 表中加载时跳过 csv 的第一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好朋友,
我在以下命令的帮助下在 hive 中创建了表 -
I created table in hive with help of following command -
CREATE TABLE db.test
(
fname STRING,
lname STRING,
age STRING,
mob BIGINT
) row format delimited fields terminated BY ' ' stored AS textfile;
现在从文件加载表中的数据,我使用以下命令 -
Now to load data in table from file, I am using following command -
load data local inpath '/home/cluster/TestHive.csv' into table db.test;
问题是,所有的行都被插入了,我不想要第一行,因为它只包含列名.
Problem is, all the rows are getting inserted, and I don't want first row because it contains only column names.
请给我建议一种跳过第一行的方法.
Please suggest me a way to skip first line.
提前致谢.
推荐答案
要获得此功能,您可以使用 hive 的属性 TBLPROPERTIES ("skip.header.line.count"="1")
你也可以参考例子-
To get this you can use hive's property which is TBLPROPERTIES ("skip.header.line.count"="1")
you can also refer example -
CREATE TABLE temp
(
name STRING,
id INT
)
row format delimited fields terminated BY ' ' lines terminated BY '
'
tblproperties("skip.header.line.count"="1");
这篇关于在 hive 表中加载时跳过 csv 的第一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文