使用分区创建外部 [英] Create external with Partition

查看:67
本文介绍了使用分区创建外部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在hadoop中有数据,并使用分区(日期和小时)创建了一个外部表。创建表是好的,但是当我试图查询数据即时通讯没有得到任何结果。

I have data in hadoop and created a external table using partitions (date and hour). The table creation is fine but when i try to query the data i m not getting any results.

Hadoop文件路径 - > / test / dt = 2012-01-30 / hr = 17 / testdata *

Hadoop file path -> /test/dt=2012-01-30/hr=17/testdata*

创建语句 - >

CREATE EXTERNAL TABLE test(adate STRING,
remoteIp STRING,
url STRING,
type STRING,
ip STRING,
useragent STRING)
COMMENT 'This is the Test view table'
PARTITIONED BY(dt STRING, hr STRING)
ROW FORMAT SERDE 'com.test.serde.ValidRawDataSerDe'
STORED AS SEQUENCEFILE
LOCATION '/test';

表格创建信息 - >

Table Creation message ->

OK
Time taken: 0.078 seconds

当我使用select query im not getting results - >

When i use select query i m not getting results ->

hive> select * from test;
OK
Time taken: 0.052 seconds
hive> select * from test where dt='2008-08-09' and hr='17';  
OK

我在这里丢失了什么。请帮助。

Am i missing anything here. Please help.

推荐答案

是的。您需要通知Hive有关新分区。要使用的命令是ALTER TABLE ... ADD PARTITION。

Yes. You need to inform Hive about the new partition. The command to use is ALTER TABLE ... ADD PARTITION.

这篇关于使用分区创建外部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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