#HQL
张之海
硕士毕业于东北大学,现就职于北京某猫头鹰公司,大数据工程师职位。
展开
-
HQL底层原理及优化:(一)使用group by代替distinct,以防数据倾斜。
本文转载自hive性能优化使用group by替代distinct原理-weixin_42412645,感谢作者的知识分享,文章已讲解得非常清晰,笔者不再赘述。日常业务统计中经常使用除重(distinct)操作,但是当出现某一组数据特别多时就会出现数据倾斜。于是在SQL编写的时候就使用group by来代替distinct,从而让执行效率提升。下面说一下个人的理解。原始数据page_test表...转载 2020-04-20 11:05:23 · 1690 阅读 · 0 评论 -
HQL不常用语法
1 删除Hive表中一个或多个分区alter table drop partition(ymd=20200415)alter table drop partition(ymd>=20200415)alter table drop partition(ymd>=20200401,ymd<=20200415) -- 分区区间,中间用逗号。...原创 2020-04-15 15:39:41 · 249 阅读 · 0 评论 -
工作中使用HQL踩得坑
1 distinct语句:select distinct uid,gender …错误理解:distinct只会将紧跟在distinct后的第一个字段去重。正确理解:distinct会按照后面的所有字段,去重。select distinct uid,gender ...结果uidgender10010女10010女10011男2 inser...原创 2020-04-10 15:25:40 · 349 阅读 · 0 评论 -
高级HQL
网络上有大量好文章来解释的,本文就不再做二次解释了,只列出其网址,可自行参考。explode与posexplodelateral viewntile()分析函数ntile(组数)null first与null lastoracle排序中使用null first与null last前一小节中的《分析函数ntile(组数)》一文中也使用到了null last。collect_list...原创 2020-03-27 11:19:36 · 326 阅读 · 0 评论 -
HQL 工作bug总结
HQL工作BUG总结1 distinct2 insert overwrite table3 select xx1,xx2 from t group by xx1,xx21 distinctdistinct后面跟多个字段时,会根据所有字段的组合进行去重。而不是只根据紧跟在distinct后面的那一个字段去重。2 insert overwrite tableinsert overwrite...原创 2020-03-27 10:43:23 · 231 阅读 · 0 评论