【问题标题】:Hive - where older than x daysHive - 超过 x 天
【发布时间】:2017-03-19 13:43:54
【问题描述】:

在 AWS Athena 表中,我有一个时间戳列,看起来像,

select  eventtime from cloudtrail_logs limit 1

eventtime
--------- 
2016-10-21T01:18:28Z

我需要获取超过 7 天的事件时间。

我试过current()unix_timestamp,但没有运气。

【问题讨论】:

  • 只是为了验证?列的类型是什么?
  • 它的字符串类型

标签: date amazon-web-services hive amazon-athena


【解决方案1】:
select  *
from    cloudtrail_logs 
where   eventtime >= date_format(current_date - interval '7' day,'%Y-%m-%d')
;

澄清:

select date_format(current_date - interval '7' day,'%Y-%m-%d');

2017-03-12

【讨论】:

  • 查看更新的答案。仅使用日期就足够了。
猜你喜欢
  • 2013-06-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-04-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多