错误:

代码:
select videoId,category
from gulivideo_orc
where videoId in (
select relatedId_name
from (
select relatedId, `views`
from gulivideo_orc
order by `views` desc
limit 50
) t1--找到top50
lateral view explode(relatedId) tmp as relatedId_name
) t2 --找出top50对应的相关视频Id
原因:经过多种测试发现是因为lateral view explode() 函数导致的,
解决方法:通过子查询再进行一次封装即可
select videoId,category
from gulivideo_orc
where videoId in (
select *
from (
select relatedId_name
from (
select rel

本文探讨了一种SQL查询错误,该错误出现在使用lateral view explode函数时。通过分析问题,发现该函数是导致查询性能下降的原因。解决方案是通过将查询包裹在一个额外的子查询中,从而避免了直接使用lateral view explode。这种方法成功地优化了查询,使其能够正确处理top50高浏览量视频的相关视频Id。
最低0.47元/天 解锁文章
1211





