Exchange with bucketing
I have two tables with bucketing enabled.
DESCRIBE EXTENDED table1
Table |table1 | |
|Owner |user | |
|Created |Wed Nov 21 16:24:25 CST 2018 | |
|Last Access |Wed Dec 31 18:00:00 CST 1969 | |
|Type |MANAGED | |
|Provider |parquet | |
|Num Buckets |180 | |
|Bucket Columns |[`seq_id`] | |
|Sort Columns |[`seq_id`]
DESCRIBE EXTENDED table2
Table |table2 | |
|Owner |user | |
|Created |Wed Nov 21 16:15:09 CST 2018 | |
|Last Access |Wed Dec 31 18:00:00 CST 1969 | |
|Type |MANAGED | |
|Provider |parquet | |
|Num Buckets |180 | |
|Bucket Columns |[`seq_id`] | |
|Sort Columns |[`seq_id`]
Then I expect that it will let me avoid shuffling (exchange) when I join both of them.
However, exchange is there:
spark.table("table2").join(spark.table("table1"), "seq_id").explain
== Physical Plan ==
Project [seq_id#0, field1#1, ... 165 more fields]
+- SortMergeJoin [seq_id#0], [seq_id#196], Inner
:- *Sort [seq_id#0 ASC NULLS FIRST], false, 0
: +- Exchange(coordinator id: 713544719) hashpartitioning(seq_id#0, 200), coordinator[target post-shuffle partition size: 77108864]
: +- *Project [seq_id#0, field1#1, ... 73 more fields]
: +- *Filter isnotnull(seq_id#0)
: +- *FileScan parquet
test2[seq_id#0, field1#1,... 73 more fields] Batched: true, Format: Parquet, Location: InMemoryFileIndex[maprfs:/ds/hive/warehouse/test2..., PartitionFilters: , PushedFilters: [IsNotNull(seq_id)], ReadSchema: struct<seq_id:string,field1:string...
+- *Sort [seq_id#196 ASC NULLS FIRST], false, 0
+- Exchange(coordinator id: 713544719) hashpartitioning(seq_id#196, 200), coordinator[target post-shuffle partition size: 77108864]
+- *Project [line_s#195, seq_id#196, field1#197, ... 69 more fields]
+- *Filter isnotnull(seq_id#196)
+- *FileScan parquet test1[line_s#195,seq_id#196,field1#197,69 more fields] Batched: true, Format: Parquet, Location: InMemoryFileIndex[maprfs:/ds/test1..., PartitionFilters: , PushedFilters: [IsNotNull(seq_id)], ReadSchema: struct<line_s:string,seq_id:string,field1:string,...
I am using Spark 2.2.1, any idea what could be the reason that exchange still happens there?
Tables (table1 and tables2) were created as below:
spark.table("src_table1").write
.bucketBy(180, "seq_id")
.sortBy("seq_id")
.saveAsTable("table1")
spark.table("src_table2").write
.bucketBy(180, "seq_id")
.sortBy("seq_id")
.saveAsTable("table2")
Hive tables src_table1 and src_table2 are parquet format with no buckets.
apache-spark apache-spark-sql
add a comment |
I have two tables with bucketing enabled.
DESCRIBE EXTENDED table1
Table |table1 | |
|Owner |user | |
|Created |Wed Nov 21 16:24:25 CST 2018 | |
|Last Access |Wed Dec 31 18:00:00 CST 1969 | |
|Type |MANAGED | |
|Provider |parquet | |
|Num Buckets |180 | |
|Bucket Columns |[`seq_id`] | |
|Sort Columns |[`seq_id`]
DESCRIBE EXTENDED table2
Table |table2 | |
|Owner |user | |
|Created |Wed Nov 21 16:15:09 CST 2018 | |
|Last Access |Wed Dec 31 18:00:00 CST 1969 | |
|Type |MANAGED | |
|Provider |parquet | |
|Num Buckets |180 | |
|Bucket Columns |[`seq_id`] | |
|Sort Columns |[`seq_id`]
Then I expect that it will let me avoid shuffling (exchange) when I join both of them.
However, exchange is there:
spark.table("table2").join(spark.table("table1"), "seq_id").explain
== Physical Plan ==
Project [seq_id#0, field1#1, ... 165 more fields]
+- SortMergeJoin [seq_id#0], [seq_id#196], Inner
:- *Sort [seq_id#0 ASC NULLS FIRST], false, 0
: +- Exchange(coordinator id: 713544719) hashpartitioning(seq_id#0, 200), coordinator[target post-shuffle partition size: 77108864]
: +- *Project [seq_id#0, field1#1, ... 73 more fields]
: +- *Filter isnotnull(seq_id#0)
: +- *FileScan parquet
test2[seq_id#0, field1#1,... 73 more fields] Batched: true, Format: Parquet, Location: InMemoryFileIndex[maprfs:/ds/hive/warehouse/test2..., PartitionFilters: , PushedFilters: [IsNotNull(seq_id)], ReadSchema: struct<seq_id:string,field1:string...
+- *Sort [seq_id#196 ASC NULLS FIRST], false, 0
+- Exchange(coordinator id: 713544719) hashpartitioning(seq_id#196, 200), coordinator[target post-shuffle partition size: 77108864]
+- *Project [line_s#195, seq_id#196, field1#197, ... 69 more fields]
+- *Filter isnotnull(seq_id#196)
+- *FileScan parquet test1[line_s#195,seq_id#196,field1#197,69 more fields] Batched: true, Format: Parquet, Location: InMemoryFileIndex[maprfs:/ds/test1..., PartitionFilters: , PushedFilters: [IsNotNull(seq_id)], ReadSchema: struct<line_s:string,seq_id:string,field1:string,...
I am using Spark 2.2.1, any idea what could be the reason that exchange still happens there?
Tables (table1 and tables2) were created as below:
spark.table("src_table1").write
.bucketBy(180, "seq_id")
.sortBy("seq_id")
.saveAsTable("table1")
spark.table("src_table2").write
.bucketBy(180, "seq_id")
.sortBy("seq_id")
.saveAsTable("table2")
Hive tables src_table1 and src_table2 are parquet format with no buckets.
apache-spark apache-spark-sql
add a comment |
I have two tables with bucketing enabled.
DESCRIBE EXTENDED table1
Table |table1 | |
|Owner |user | |
|Created |Wed Nov 21 16:24:25 CST 2018 | |
|Last Access |Wed Dec 31 18:00:00 CST 1969 | |
|Type |MANAGED | |
|Provider |parquet | |
|Num Buckets |180 | |
|Bucket Columns |[`seq_id`] | |
|Sort Columns |[`seq_id`]
DESCRIBE EXTENDED table2
Table |table2 | |
|Owner |user | |
|Created |Wed Nov 21 16:15:09 CST 2018 | |
|Last Access |Wed Dec 31 18:00:00 CST 1969 | |
|Type |MANAGED | |
|Provider |parquet | |
|Num Buckets |180 | |
|Bucket Columns |[`seq_id`] | |
|Sort Columns |[`seq_id`]
Then I expect that it will let me avoid shuffling (exchange) when I join both of them.
However, exchange is there:
spark.table("table2").join(spark.table("table1"), "seq_id").explain
== Physical Plan ==
Project [seq_id#0, field1#1, ... 165 more fields]
+- SortMergeJoin [seq_id#0], [seq_id#196], Inner
:- *Sort [seq_id#0 ASC NULLS FIRST], false, 0
: +- Exchange(coordinator id: 713544719) hashpartitioning(seq_id#0, 200), coordinator[target post-shuffle partition size: 77108864]
: +- *Project [seq_id#0, field1#1, ... 73 more fields]
: +- *Filter isnotnull(seq_id#0)
: +- *FileScan parquet
test2[seq_id#0, field1#1,... 73 more fields] Batched: true, Format: Parquet, Location: InMemoryFileIndex[maprfs:/ds/hive/warehouse/test2..., PartitionFilters: , PushedFilters: [IsNotNull(seq_id)], ReadSchema: struct<seq_id:string,field1:string...
+- *Sort [seq_id#196 ASC NULLS FIRST], false, 0
+- Exchange(coordinator id: 713544719) hashpartitioning(seq_id#196, 200), coordinator[target post-shuffle partition size: 77108864]
+- *Project [line_s#195, seq_id#196, field1#197, ... 69 more fields]
+- *Filter isnotnull(seq_id#196)
+- *FileScan parquet test1[line_s#195,seq_id#196,field1#197,69 more fields] Batched: true, Format: Parquet, Location: InMemoryFileIndex[maprfs:/ds/test1..., PartitionFilters: , PushedFilters: [IsNotNull(seq_id)], ReadSchema: struct<line_s:string,seq_id:string,field1:string,...
I am using Spark 2.2.1, any idea what could be the reason that exchange still happens there?
Tables (table1 and tables2) were created as below:
spark.table("src_table1").write
.bucketBy(180, "seq_id")
.sortBy("seq_id")
.saveAsTable("table1")
spark.table("src_table2").write
.bucketBy(180, "seq_id")
.sortBy("seq_id")
.saveAsTable("table2")
Hive tables src_table1 and src_table2 are parquet format with no buckets.
apache-spark apache-spark-sql
I have two tables with bucketing enabled.
DESCRIBE EXTENDED table1
Table |table1 | |
|Owner |user | |
|Created |Wed Nov 21 16:24:25 CST 2018 | |
|Last Access |Wed Dec 31 18:00:00 CST 1969 | |
|Type |MANAGED | |
|Provider |parquet | |
|Num Buckets |180 | |
|Bucket Columns |[`seq_id`] | |
|Sort Columns |[`seq_id`]
DESCRIBE EXTENDED table2
Table |table2 | |
|Owner |user | |
|Created |Wed Nov 21 16:15:09 CST 2018 | |
|Last Access |Wed Dec 31 18:00:00 CST 1969 | |
|Type |MANAGED | |
|Provider |parquet | |
|Num Buckets |180 | |
|Bucket Columns |[`seq_id`] | |
|Sort Columns |[`seq_id`]
Then I expect that it will let me avoid shuffling (exchange) when I join both of them.
However, exchange is there:
spark.table("table2").join(spark.table("table1"), "seq_id").explain
== Physical Plan ==
Project [seq_id#0, field1#1, ... 165 more fields]
+- SortMergeJoin [seq_id#0], [seq_id#196], Inner
:- *Sort [seq_id#0 ASC NULLS FIRST], false, 0
: +- Exchange(coordinator id: 713544719) hashpartitioning(seq_id#0, 200), coordinator[target post-shuffle partition size: 77108864]
: +- *Project [seq_id#0, field1#1, ... 73 more fields]
: +- *Filter isnotnull(seq_id#0)
: +- *FileScan parquet
test2[seq_id#0, field1#1,... 73 more fields] Batched: true, Format: Parquet, Location: InMemoryFileIndex[maprfs:/ds/hive/warehouse/test2..., PartitionFilters: , PushedFilters: [IsNotNull(seq_id)], ReadSchema: struct<seq_id:string,field1:string...
+- *Sort [seq_id#196 ASC NULLS FIRST], false, 0
+- Exchange(coordinator id: 713544719) hashpartitioning(seq_id#196, 200), coordinator[target post-shuffle partition size: 77108864]
+- *Project [line_s#195, seq_id#196, field1#197, ... 69 more fields]
+- *Filter isnotnull(seq_id#196)
+- *FileScan parquet test1[line_s#195,seq_id#196,field1#197,69 more fields] Batched: true, Format: Parquet, Location: InMemoryFileIndex[maprfs:/ds/test1..., PartitionFilters: , PushedFilters: [IsNotNull(seq_id)], ReadSchema: struct<line_s:string,seq_id:string,field1:string,...
I am using Spark 2.2.1, any idea what could be the reason that exchange still happens there?
Tables (table1 and tables2) were created as below:
spark.table("src_table1").write
.bucketBy(180, "seq_id")
.sortBy("seq_id")
.saveAsTable("table1")
spark.table("src_table2").write
.bucketBy(180, "seq_id")
.sortBy("seq_id")
.saveAsTable("table2")
Hive tables src_table1 and src_table2 are parquet format with no buckets.
apache-spark apache-spark-sql
apache-spark apache-spark-sql
edited Nov 22 '18 at 0:16
user10465355
2,1192521
2,1192521
asked Nov 21 '18 at 23:27
Tomasz KrolTomasz Krol
241214
241214
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Seems like adaptive query execution enabled (spark.sql.adaptive.enabled=true) was the problem. After disabling this, exchange is not there anymore. Need to dig more, why it happens.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53421867%2fexchange-with-bucketing%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Seems like adaptive query execution enabled (spark.sql.adaptive.enabled=true) was the problem. After disabling this, exchange is not there anymore. Need to dig more, why it happens.
add a comment |
Seems like adaptive query execution enabled (spark.sql.adaptive.enabled=true) was the problem. After disabling this, exchange is not there anymore. Need to dig more, why it happens.
add a comment |
Seems like adaptive query execution enabled (spark.sql.adaptive.enabled=true) was the problem. After disabling this, exchange is not there anymore. Need to dig more, why it happens.
Seems like adaptive query execution enabled (spark.sql.adaptive.enabled=true) was the problem. After disabling this, exchange is not there anymore. Need to dig more, why it happens.
answered Nov 22 '18 at 23:19
Tomasz KrolTomasz Krol
241214
241214
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53421867%2fexchange-with-bucketing%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown