在 Hadoop Hive 中给定时间戳,如何获取一周第一天的日期? [英] How to get the Date of the first day of a week given a time stamp in Hadoop Hive?

查看:14
本文介绍了在 Hadoop Hive 中给定时间戳,如何获取一周第一天的日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

除了编写自定义 UDF 来支持此问题外,是否有任何已知的方法可以实现此目的?我目前使用的是 Hive 0.13.

Besides writing a custom UDF to support this issue, is there any known methods of achieving this? I'm currently using Hive 0.13.

推荐答案

从 Hive 1.2 开始,你也可以这样做:

Starting with Hive 1.2, you can also do it like this:

select next_day(date_sub('2019-01-01', 7), 'MON')

输出:

2018-12-31

这篇关于在 Hadoop Hive 中给定时间戳,如何获取一周第一天的日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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