hive分区表插入和查询

本文介绍了Hive分区表的插入错误及其解决办法,强调在插入时需明确指定分区列。同时,展示了如何进行分区表的查询以及创建分区表的语法,特别指出分区字段的定义和使用textfile存储格式的重要性。最后提到了清空分区表内容的命令。
摘要由CSDN通过智能技术生成

hive分区表插入报错

In Hive the partitioning "columns" are managed as metadata >> they are not included in the data files, instead they are used as sub-directory names. So your partitioned table has just 2 real columns, and you must feed just 2 columns with your SELECT.

学习链接

解决办法如下:

你应该:insert into table part partition(sex='M') select id,name from non_part where sex='M';(对,你要插入的就是两列,分区列不作为数据保存在数据表中)

而不是:insert into table part partition(sex='M') select  *  from non_part where sex='M';

hive分区表查询

FAILED: SemanticException [Error 10041]: No partition predicate found for Alias "table" Table "table"

 
select * from table where d="2019-07-14"

其中d表示分区字段

hive创建分区表<

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值