繁体   English   中英

蜂巢桶式表在物理计划中进行交换和排序步骤

[英]hive bucketed table doing exchange and sort step in physical plan

我有两个表都聚集在同一列上,但是将两个表都连接在聚集列上时,执行计划将显示交换和排序步骤。

两个表都存储在同一列(key_column)上。 这两个表都是或已压缩的,表A进行了分区和存储,而表B则存储在同一列上。

我想避免计划中的排序和交换步骤,而根据文档,存储桶表应该避免排序和交换步骤。

我什至尝试了以下蜂巢属性:

spark.sql('set spark.sql.orc.filterPushdown=true')
spark.sql('set hive.optimize.bucketmapjoin = true')
spark.sql('set hive.optimize.bucketmapjoin.sortedmerge = true')
spark.sql('set hive.input.format=org.apache.hadoop.hive.ql.io.BucketizedHiveInputFormat')
spark.sql('set hive.optimize.bucketmapjoin = true')
spark.sql('set hive.stats.autogather=true')
spark.sql('set hive.compute.query.using.stats=true')
spark.sql('set hive.optimize.index.filter=true')

also collected stats for the tables:

在物理计划中可以同时看到“排序”和“交换”,但是配置分区的表应该避免排序和交换步骤

 [count#1311L])
          +- *Project
             +- *SortMergeJoin [key_column#1079], [key_column#1218],Inner
sort step:                :- *Sort [key_column#1079 ASC NULLS FIRST], false, 0
    exchange step:            :  +- Exchange hashpartitioning(key_column#1079, 200)
                :     +- *Filter isnotnull(key_column#1079)

预期结果:不会排序和交换

    [count#1311L])
              +- *Project
                 +- *SortMergeJoin [key_column#1079], [key_column#1218], Inner
                    :     +- *Filter isnotnull(key_column#1079)`enter code here`

我想避免计划中的排序和交换步骤,而根据文档,存储桶表应该避免排序和交换步骤。

Hive和Spark的存储桶语义不同。
在Spark中读取从Hive创建的存储桶表时,将不遵守Hive存储桶语义。
要利用Spark存储桶功能,必须使用Spark创建表。

开源的设计文档,详细说明了Hive和Spark存储桶之间的区别: https ://docs.google.com/document/d/1a8IDh23RAkrkg9YYAeO51F4aGO8-xAlupKwdshve2fc/edit#heading=h.fbzz4lt51r0

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM