У меня был сценарий, в котором я хотел рассчитать дату окончания недели (с учетом даты), учитывая, что неделя заканчивается в субботу. Я прочитал некоторые ответы, но не смог найти решение, поэтому я публикую свой подход здесь. Надеюсь, это поможет кому-то вроде меня.
select
TransactionDateTime,
from_unixtime(unix_timestamp(TransactionTime),'u') as wkday,
date_add (TransactionDateTime,
case when from_unixtime(unix_timestamp(TransactionTime),'u')=7 then 6
when from_unixtime(unix_timestamp(TransactionTime),'u')=1 then 5
when from_unixtime(unix_timestamp(TransactionTime),'u')=2 then 4
when from_unixtime(unix_timestamp(TransactionTime),'u')=3 then 3
when from_unixtime(unix_timestamp(TransactionTime),'u')=4 then 2
when from_unixtime(unix_timestamp(TransactionTime),'u')=5 then 1
when from_unixtime(unix_timestamp(TransactionTime),'u')=6 then 0
end) as UsageWkEndDt
from TransTable;
next_day(string start_date, string day_of_week)
cf. cwiki.apache.org/confluence/display/Hive/ а> - person Samson Scharfrichter   schedule 03.03.2016