在给用户推荐表中,由于待推荐的话题数太多,所以随机抽样检测。
表
user_recs_categroy
userinfoid 用户ID
simtopicid 话题ID
复制代码
1
2
3
4
5select a1.userinfoid,a1.simtopicid from (select a1.userinfoid,a1.simtopicid,row_number()over(partition by a1.userinfoid order by rand()) rn from user_recs_categroy a1) a1 where rn<=5 limit 20;
结果显示
第一次:
复制代码
1
2
3
4
5
62 15850 2 16024 2 16986 2 16166 2 16383
第二次:
复制代码
1
2
3
4
5
62 17029 2 16547 2 15878 2 16044 2 15742
最后
以上就是迷人仙人掌最近收集整理的关于Hive中随机抽样的全部内容,更多相关Hive中随机抽样内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复