配置单元加载特定列 [英] Hive load specific columns

查看:78
本文介绍了配置单元加载特定列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



是否可以直接加载特定列,或者我应该加载所有数据并创建第二个表用于选择特定的列?



谢谢 解决方案

是的,你必须加载所有这样的数据:

  LOAD DATA [LOCAL] INPATH / Your / Path [OVERWRITE] INTO TABLE yourTable; 

LOCAL表示您的文件位于本地系统而不是HDFS中,OVERWRITE表示当前数据在表中将被删除。



所以你创建第二个只包含你需要的字段的表并执行这个查询:

  INSERT OVERWRITE TABLE yourNewTable 
yourSelectStatement
FROM yourOldTable;


I am interested in loading specific columns into a table created in Hive.

Is it possible to load the specific columns directly or I should load all the data and create a second table to SELECT the specific columns?

Thanks

解决方案

Yes you have to load all the data like this :

LOAD DATA [LOCAL] INPATH /Your/Path [OVERWRITE] INTO TABLE yourTable;

LOCAL means that your file is on your local system and not in HDFS, OVERWRITE means that the current data in the table will be deleted.

So you create a second table with only the fields you need and you execute this query :

INSERT OVERWRITE TABLE yourNewTable 
yourSelectStatement 
FROM yourOldTable;

这篇关于配置单元加载特定列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆