在Hive中查找一个月的最后一天 [英] Find last day of a month in Hive

查看:6515
本文介绍了在Hive中查找一个月的最后一天的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是:有没有办法在Hive中查找一个月的最后一天,比如Oracle SQL函数? :



LAST_DAY(D_Dernier_Jour)



使用 last_day(dateString) Nexr。它根据日期字符串返回月份的最后一天,日期字符串为yyyy-MM-dd HH:mm:ss模式。

 例如:
SELECT last_day('2003-03-15 01:22:33')FROM src LIMIT 1;
2003-03-31 00:00:00

您需要将其从他们的 Github Repository 和构建。他们的wiki页面包含有关如何在Hive上构建和使用它的所有信息。



HTH


My question is : Is there a way to do find the last day of a month in Hive, like Oracle SQL function ? :

LAST_DAY(D_Dernier_Jour)

Thanks.

解决方案

You could make use of last_day(dateString) UDF provided by Nexr. It returns the last day of the month based on a date string with yyyy-MM-dd HH:mm:ss pattern.

Example:
SELECT last_day('2003-03-15 01:22:33') FROM src LIMIT 1;
2003-03-31 00:00:00

You need to pull it from their Github Repository and build. Their wiki page contains all the info on how to build and use it with Hive.

HTH

这篇关于在Hive中查找一个月的最后一天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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