【发布时间】:2014-10-19 13:14:39
【问题描述】:
我有一个按年、月、日和小时进行分区的配置单元外部表。
PARTITIONED BY (
`year` int,
`month` int,
`day` int,
`hour` int)
ROW FORMAT SERDE
'org.openx.data.jsonserde.JsonSerDe'
STORED AS INPUTFORMAT
'org.apache.hadoop.mapred.SequenceFileInputFormat'
OUTPUTFORMAT
'org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat'
LOCATION
'hdfs://path/to/data'
数据存在于目录如
2014/05/10/07/00
2014/05/10/07/01
...
2014/05/10/07/22
2014/05/10/07/23
当我使用以下方法选择数据时,我得到了结果:
Select * from my_table where year=2014 and month="05" and day="07" and hour="03"
但我希望能够在不带引号的情况下查询以零开头的值。目前以下两个示例不起作用:
Select * from my_table where year=2014 and month=05 and day=07 and hour=03
Select * from my_table where year=2014 and month=5 and day=7 and hour=3
我该如何支持这一点? (而不是将目录更改为在单个数字值上不具有零前缀)。
谢谢,
男人
【问题讨论】:
-
提供双引号有什么问题?