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

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

问题描述

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

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)

谢谢.

推荐答案

你可以使用 Nexr 提供的 last_day(dateString) UDF.它根据具有 yyyy-MM-dd HH:mm:ss 模式的日期字符串返回该月的最后一天.

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

您需要从他们的 Github 存储库 中提取并构建.他们的 wiki 页面包含有关如何构建和使用 Hive 的所有信息.

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天全站免登陆