Для Hive> = 1.3.0 используйте функцию quarter(date)
, для Hive <1.3.0 используйте <code>ceil(month(date) / 3.0) как четверть
select
min(cast(concat(year(startdate),quarter(startdate)) as bigint)) as st_dte,
max(cast(concat(year(enddate),quarter(enddate)) as bigint)) as end_dte,
a_id,
carr as bar_code,
case when wac < 100 then 'Dom Flg bar' else 'Int Flg bar' end as bar_flag,
case when a_id in (343, 455, 123, 656, 645) then 1 else 0 end as lcc_bar
from oair_cardecode
group by a_id, carr,
case when wac < 100 then 'Dom Flg bar' else 'Int Flg bar' end,
case when a_id in (343, 455, 123, 656, 645) then 1 else 0 end;