自己在路径访问明细表开发时,写的sql如下
SELECT guid, sessionid, event['url'] as page, `timestamp` as ts, row_number() over(PARTITION BY guid,sessionid ORDER BY `timestamp`) AS stepno, lag(event['url'],1,null) over(partition by guid,sessionid order by `timestamp`) AS referral, lead(`timestamp`,1,null) over(partition by guid,sessionid order by `timestamp`) -`timestamp` AS stay_time FROM DWD_APL_TFC_DTL WHERE dt='2020-05-07' limit 10;
在hive中执行时,一直报错,查看hive日志,其报如下错误
通过查看其它的日志内容,发现map端是没有问题的,再结合上面org.apache.hadoop.hive.ql.metadata.HiveException: Internal Error: cannot generate all output rows for a Partition问题,猜测应该是数据倾斜的问题,通过观察自己的数据,发现取出的
event['url']会存在null的情况,为了证实确实是null值过多造成数据倾斜的情况,于是利用sql语句去查询确实是null值过多,被分配到一个分区。找到问题所在就好办了,由于业务允许,自己直接将值为null的值过滤掉,然后就没报错了。