【问题标题】:what is equivalent of prestodb date_trunc in hive什么相当于 hive 中的 prestodb date_trunc
【发布时间】:2018-09-11 18:54:45
【问题描述】:

我有一个使用 DATE_TRUNC 的 prestodb 查询,如下所示:

DATE_TRUNC('week', DATE(dd.signup_timestamp))

hive 中的等价物是什么?

另一个类似的问题是,这个表达式在 presto in hive 中是什么意思:

date_sub(date_trunc('week', now()), 180)

【问题讨论】:

    标签: hive presto


    【解决方案1】:
    select date_sub('2018-09-05', cast(from_unixtime(unix_timestamp(), 'u') AS int)) as c;
    output: 2018-09-03
    

    对于其他:

    date_sub(date_sub(from_unixtimestamp(unix_timestamp(), cast(from_unixtime(unix_timestamp(), 'u'), 'u')as int)), 180)
    

    【讨论】:

      猜你喜欢
      • 2021-10-01
      • 2018-05-28
      • 2013-12-05
      • 2017-05-12
      • 1970-01-01
      • 1970-01-01
      • 2018-12-15
      • 2020-04-26
      • 2019-09-12
      相关资源
      最近更新 更多