【发布时间】:2014-07-23 17:15:52
【问题描述】:
我有如下形式的数据:
hive> desc test;
no string
txdate string
hive>
hive> select * from test;
1 2014-06-01 10:12:12.100
1 2014-06-01 10:12:14.100
1 2014-06-01 10:12:16.100
1 2014-06-01 10:13:12.100
1 2014-06-01 10:14:12.100
我需要使用 txdate 列对数据进行分组并截断到最后一分钟。输出应如下所示
3 2014-06-01 10:12:00
1 2014-06-01 10:13:00
1 2014-06-01 10:14:00
谁能帮我用 Hive 选择查询来解决这个问题?
【问题讨论】:
-
您想告诉我们您的尝试吗?您可以在
HIVE中使用GROUP BY。 -
看看from_unixtime()和unix_timestamp()
标签: date select group-by hive minute