为了账号安全,请及时绑定邮箱和手机立即绑定

left join 执行计划

标签:
Java
explain select s.id, s.name from student s left outer join student_tmp st on s.name = st.name;
STAGE DEPENDENCIES: “这个sql将被分成两个阶段执行。基本上每个阶段会对应一个mapreduce job,Stage-0除外。因为Stage-0只是fetch结果集,不需要mapreduce job”
  Stage-1 is a root stage
  Stage-0 is a root stage
STAGE PLANS:
  Stage: Stage-1
    Map Reduce
      Alias -> Map Operator Tree: “map job开始”
        s
          TableScan
            alias: s “扫描表student”
            Reduce Output Operator “这里描述map的输出,也就是reduce的输入。比如key,partition,sort等信息。”
              key expressions: “reduce job的key”
                    expr: name
                    type: string
              sort order: + “这里表示按一个字段排序,如果是按两个字段排序,那么就会有两个+(++),更多以此类推”
              Map-reduce partition columns: “partition的信息,由此也可以看出hive在join的时候会以join on后的列作为partition的列,以保证具有相同此列的值的行被分到同一个reduce中去”
                    expr: name
                    type: string
              tag: 0 “用于标示这个扫描的结果,后面的join会用到它”
              value expressions: “表示select 后面的列”
                    expr: id
                    type: int
                    expr: name
                    type: string
        st
          TableScan “开始扫描第二张表,和上面的一样”
            alias: st
            Reduce Output Operator
              key expressions:
                    expr: name
                    type: string
              sort order: +
              Map-reduce partition columns:
                    expr: name
                    type: string
              tag: 1
      Reduce Operator Tree: “reduce job开始”
        Join Operator
          condition map:
               Left Outer Join0 to 1 “tag 0 out join tag 1”
          condition expressions: “这里也是描述select 后的列,和join没有关系。这里我们的select后的列是 s.id 和 s.name, 所以0后面有两个字段, 1后面没有”
{VALUE._col0} {VALUE._col2}
          handleSkewJoin: false
          outputColumnNames: _col0, _col2
          Select Operator
            expressions:
                  expr: _col0
                  type: int
                  expr: _col2
                  type: string
            outputColumnNames: _col0, _col1
            File Output Operator
              compressed: false
              GlobalTableId: 0
              table:
                  input format: org.apache.hadoop.mapred.TextInputFormat
                  output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
  Stage: Stage-0
    Fetch Operator
      limit: -1
Time taken: 0.216 seconds



作者:scandly
链接:https://www.jianshu.com/p/47a3a47b7929


点击查看更多内容
TA 点赞

若觉得本文不错,就分享一下吧!

评论

作者其他优质文章

正在加载中
  • 推荐
  • 评论
  • 收藏
  • 共同学习,写下你的评论
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦
今天注册有机会得

100积分直接送

付费专栏免费学

大额优惠券免费领

立即参与 放弃机会
意见反馈 帮助中心 APP下载
官方微信

举报

0/150
提交
取消