1
私はSpark-2.2を使用しています。 私はSparkのバケツをPocingしています。私はバケット表を作成しました は、ここdesc formatted my_bucketed_tbl
出力です:スパークバケット化とcollect_set集約
+--------------------+--------------------+-------+
| col_name| data_type|comment|
+--------------------+--------------------+-------+
| bundle| string| null|
| ifa| string| null|
| date_| date| null|
| hour| int| null|
| | | |
|# Detailed Table ...| | |
| Database| default| |
| Table| my_bucketed_tbl|
| Owner| zeppelin| |
| Created|Thu Dec 21 13:43:...| |
| Last Access|Thu Jan 01 00:00:...| |
| Type| EXTERNAL| |
| Provider| orc| |
| Num Buckets| 16| |
| Bucket Columns| [`ifa`]| |
| Sort Columns| [`ifa`]| |
| Table Properties|[transient_lastDd...| |
| Location|hdfs:/user/hive/w...| |
| Serde Library|org.apache.hadoop...| |
| InputFormat|org.apache.hadoop...| |
| OutputFormat|org.apache.hadoop...| |
| Storage Properties|[serialization.fo...| |
+--------------------+--------------------+-------+
私は、我々は為替相免れてきたことがわかります、クエリでグループの説明を実行していた場合:
sql("select ifa,max(bundle) from my_bucketed_tbl group by ifa").explain
== Physical Plan ==
SortAggregate(key=[ifa#932], functions=[max(bundle#920)])
+- SortAggregate(key=[ifa#932], functions=[partial_max(bundle#920)])
+- *Sort [ifa#932 ASC NULLS FIRST], false, 0
+- *FileScan orc default.level_1[bundle#920,ifa#932] Batched: false, Format: ORC, Location: InMemoryFileIndex[hdfs://ip-10-44-9-73.ec2.internal:8020/user/hive/warehouse/level_1/date_=2017-1..., PartitionFilters: [], PushedFilters: [], ReadSchema: struct<bundle:string,ifa:string>
を
しかし、私はcollect_set
でスパークのmax
機能を交換するとき、私は実行計画が交換相が惜しまれていない、非バケットテーブルと同じであることを意味していることがわかります。
sql("select ifa,collect_set(bundle) from my_bucketed_tbl group by ifa").explain
== Physical Plan ==
ObjectHashAggregate(keys=[ifa#1010], functions=[collect_set(bundle#998, 0, 0)])
+- Exchange hashpartitioning(ifa#1010, 200)
+- ObjectHashAggregate(keys=[ifa#1010], functions=[partial_collect_set(bundle#998, 0, 0)])
+- *FileScan orc default.level_1[bundle#998,ifa#1010] Batched: false, Format: ORC, Location: InMemoryFileIndex[hdfs://ip-10-44-9-73.ec2.internal:8020/user/hive/warehouse/level_1/date_=2017-1..., PartitionFilters: [], PushedFilters: [], ReadSchema: struct<bundle:string,ifa:string>
私は逃した設定がありますか、それとも、Sparkのバケット化が現時点では制限がありますか?
管理テーブルで正常に動作します。 – user6910411