随着Hive 0.10版的发布,GROUPING SETS出现了,并提供了ROLL UP和CUBE这两个特殊场景的子句,真是喜闻乐见的特性
随着Hive 0.10版的发布,GROUPING SETS出现了,并提供了ROLL UP和CUBE这两个特殊场景的子句,真是喜闻乐见的特性啊。FAILED: ParseException line 66:14 missing ) at ',' near ')' in subquery source line 66:80 mismatched input ',' expecting ) near ')' in subquery source
group by t1.my_month, t1.product, t1.usr_type, if(t3.earliest_logtime_monthly = '20140101', 'new_usr', 'old_usr'), if(t2.CTClass = 105, t1.ipcountry, t1.ipprovince), t1.ChannelID grouping sets ((t1.my_month, t1.usr_type, t1.ChannelID), (t1.my_month, t1.product, t1.usr_type, t1.ChannelID), (t1.my_month, if(t3.earliest_logtime_monthly = '20140101', 'new_usr', 'old_usr'), t1.ChannelID), (t1.my_month, t1.product, if(t3.earliest_logtime_monthly = '20140101', 'new_usr', 'old_usr'), t1.ChannelID), (t1.my_month, if(t2.Dim_CityClass = 105, t1.ipcountry, t1.ipprovince), t1.ChannelID), (t1.my_month, t1.product, if(t2.CTClass = 105, t1.ipcountry, t1.ipprovince), t1.ChannelID))
这样的情况,使我怀疑GROUPING SETS子句的括号匹配逻辑没做得很完善,导致了括号配对抛出异常。不过,具体的问题,还是需要通过研究一下Hive实现源码来进一步确定这到底是不是一个BUG。
--------------------------------------------------------------------------------------------------------------------
2014-04-28
今天发现,好像是限定性名称的原因呢!就和Java的switch...case的case子句一样,case子句里的枚举值不能用限定性名称(EnumType.EnumValue1),只能用非限定性名称(EnumValue1)!难道grouping sets的Java实现涉及到switch...case子句?有待研究。