impala 月份的最后一天

last day of month in impala

更好/更短的解决方案
select
add_months (date_sub(trunc (to_timestamp(cast (dim_evt_dte_key as string), "yyyyMMdd"), 'month'), 1), 1) as end_month
from old;

获取每个月的最后一天??有月末功能吗? EOMONTH 似乎不适用于 impala 让事情变得复杂:dim_evt_dte 是 BIGINT:20170210

您可以尝试使用 last_day() 函数

select last_day(to_timestamp(cast (dim_evt_dte_key as string), "yyyyMMdd"))

我认为 Impala 中最简单的方法是使用 trunc()date_trunc():

select (trunc(dim_evt_dte_key, 'MMM') + interval 1 month) - interval 1 day) as end_month
from old;

这假定密钥是时间戳。