Is there any expressions to get QUARTER
, WEEK
and DAYOFWEEK
of a DateTime field in Hive (v0.14.1) which do the same thing as these buildin functions in MySql?
here is the specification of what I want (from MySql doc):
QUARTER WEEK DAYOFWEEK
NOTE: 1. the function quarter() was introduced in Hive 1.3, but I need a expr to support lower version. 2. the function weekofyear() is supported instead of week(), but there is a little difference. but it's okay, so just ignore this one.
Suppose the DateTime field is order_time
PMOD(DATEDIFF(order_time, '2012-01-01'), 7)
WEEKOFYEAR(order_time)
(INT((MONTH(order_time)-1)/3)+1)
QUARTER(order_time)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With