问题总结来自:
spark dataframe怪异问题
http://www.aboutyun.com/forum.php?mod=viewthread&tid=21105
#######################
rank() 函数SQLContext并不支持。
需要用它的子类org.apache.spark.sql.hive.HiveContext来实现。
SELECT pcode,
ver,
monthday,
fncode,
country,
province,
dognum,
gid,
mac,
hardwareid,
ip,
rank() OVER (PARTITION BY pcode,ver,monthday,fncode,gid ORDER BY if(province='未知',2,1)) as rank_gid
FROM
(SELECT pcode,
ver,
monthday,
fncode,
country,
province,
dognum,
gid,
mac,
hardwareid,
ip
FROM
uv_logs
GROUP BY pcode,ver,monthday,fncode,country,province,dognum,gid,mac,hardwareid,ip) a
|
|