Hive和sparksql中的dayofweek

dayofweek在hive2.2.0开始支持
低版本的sparksql和hive中可用以下方式实现

 select 7- datediff(next_day('2018-03-12',"Sunday"),'2018-03-12').  
 select date_format('2018-03-12' ,'u').   
 select date_format(from_unixtime(unix_timestamp('20180313','yyyyMMdd'),'yyyy-MM-dd'),'u')
原文地址:https://www.cnblogs.com/sabertobih/p/13749930.html