You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/08/31 05:16:06 UTC
[GitHub] [spark] wzhfy opened a new pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
wzhfy opened a new pull request #29589:
URL: https://github.com/apache/spark/pull/29589
<!--
Thanks for sending a pull request! Here are some tips for you:
1. If this is your first time, please read our contributor guidelines: https://spark.apache.org/contributing.html
2. Ensure you have added or run the appropriate tests for your PR: https://spark.apache.org/developer-tools.html
3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][SPARK-XXXX] Your PR title ...'.
4. Be sure to keep the PR description updated to reflect all changes.
5. Please write your PR title to summarize what this PR proposes.
6. If possible, provide a concise example to reproduce the issue for a faster review.
7. If you want to add a new configuration, please read the guideline first for naming configurations in
'core/src/main/scala/org/apache/spark/internal/config/ConfigEntry.scala'.
-->
### What changes were proposed in this pull request?
<!--
Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue.
If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
2. If you fix some SQL features, you can provide some references of other DBMSes.
3. If there is design documentation, please add the link.
4. If there is a discussion in the mailing list, please add the link.
-->
Since [SPARK-22590](https://github.com/apache/spark/commit/2854091d12d670b014c41713e72153856f4d3f6a), local property propagation is supported through `SQLExecution.withThreadLocalCaptured` in both `BroadcastExchangeExec` and `SubqueryExec` when computing `relationFuture`. This pr adds the support in `SubqueryBroadcastExec`.
### Why are the changes needed?
<!--
Please clarify why the changes are needed. For instance,
1. If you propose a new API, clarify the use case for a new API.
2. If you fix a bug, you can clarify why it is a bug.
-->
Local property propagation is missed in `SubqueryBroadcastExec`.
### Does this PR introduce _any_ user-facing change?
<!--
Note that it means *any* user-facing change including all aspects such as the documentation fix.
If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
If possible, please also clarify if this is a user-facing change compared to the released Spark versions or within the unreleased branches such as master.
If no, write 'No'.
-->
No.
### How was this patch tested?
<!--
If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
If tests were not added, please describe why they were not added and/or why it was difficult to add.
-->
Add a new test.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] maropu commented on a change in pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #29589:
URL: https://github.com/apache/spark/pull/29589#discussion_r484605635
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/SubqueryBroadcastExec.scala
##########
@@ -60,10 +63,12 @@ case class SubqueryBroadcastExec(
}
@transient
- private lazy val relationFuture: Future[Array[InternalRow]] = {
+ private lazy val relationFuture: JFuture[Array[InternalRow]] = {
// relationFuture is used in "doExecute". Therefore we can get the execution id correctly here.
val executionId = sparkContext.getLocalProperty(SQLExecution.EXECUTION_ID_KEY)
- Future {
+ SQLExecution.withThreadLocalCaptured[Array[InternalRow]](
Review comment:
Thanks!
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on pull request #29589:
URL: https://github.com/apache/spark/pull/29589#issuecomment-688065955
thanks, merging to master!
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #29589:
URL: https://github.com/apache/spark/pull/29589#discussion_r481640429
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/SubqueryBroadcastExec.scala
##########
@@ -110,5 +115,6 @@ case class SubqueryBroadcastExec(
object SubqueryBroadcastExec {
private[execution] val executionContext = ExecutionContext.fromExecutorService(
- ThreadUtils.newDaemonCachedThreadPool("dynamicpruning", 16))
+ ThreadUtils.newDaemonCachedThreadPool("dynamic-pruning",
+ SQLConf.get.getConf(StaticSQLConf.SUBQUERY_MAX_THREAD_THRESHOLD)))
Review comment:
shall we use `BROADCAST_EXCHANGE_MAX_THREAD_THRESHOLD`? Physically it's a broadcast.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29589:
URL: https://github.com/apache/spark/pull/29589#issuecomment-685224351
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] wzhfy commented on a change in pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
wzhfy commented on a change in pull request #29589:
URL: https://github.com/apache/spark/pull/29589#discussion_r483406090
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/DynamicPartitionPruningSuite.scala
##########
@@ -1342,6 +1345,52 @@ abstract class DynamicPartitionPruningSuiteBase
}
}
}
+
+ test("SPARK-32748: propagate local properties to dynamic pruning thread") {
+ def checkPropertyValueByUdfResult(propKey: String, propValue: String): Unit = {
+ spark.sparkContext.setLocalProperty(propKey, propValue)
+ val df = sql(
+ s"""
+ |SELECT compare_property_value(f.date_id, '$propKey', '$propValue') as col
Review comment:
Yes, IIUC udf created by `spark.udf.register` is not foldable, so it will be evaluated in tasks. Besides, otherwise TaskContext.get() will get null if it's not run in task I think.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29589:
URL: https://github.com/apache/spark/pull/29589#issuecomment-686419413
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #29589:
URL: https://github.com/apache/spark/pull/29589#issuecomment-685224351
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #29589:
URL: https://github.com/apache/spark/pull/29589#issuecomment-686585602
**[Test build #128255 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/128255/testReport)** for PR 29589 at commit [`1cb65ec`](https://github.com/apache/spark/commit/1cb65ec97fb79b8e52b923a15de1e83759275786).
* This patch passes all tests.
* This patch merges cleanly.
* This patch adds no public classes.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #29589:
URL: https://github.com/apache/spark/pull/29589#issuecomment-683603505
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #29589:
URL: https://github.com/apache/spark/pull/29589#issuecomment-686587001
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29589:
URL: https://github.com/apache/spark/pull/29589#issuecomment-685326788
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #29589:
URL: https://github.com/apache/spark/pull/29589#issuecomment-687115432
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] wzhfy commented on a change in pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
wzhfy commented on a change in pull request #29589:
URL: https://github.com/apache/spark/pull/29589#discussion_r484684202
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/SubqueryBroadcastExec.scala
##########
@@ -60,10 +63,12 @@ case class SubqueryBroadcastExec(
}
@transient
- private lazy val relationFuture: Future[Array[InternalRow]] = {
+ private lazy val relationFuture: JFuture[Array[InternalRow]] = {
// relationFuture is used in "doExecute". Therefore we can get the execution id correctly here.
val executionId = sparkContext.getLocalProperty(SQLExecution.EXECUTION_ID_KEY)
- Future {
+ SQLExecution.withThreadLocalCaptured[Array[InternalRow]](
Review comment:
> I don't think we need a separate config. The thread pool here is used to wait for the broadcast to finish, seems better to have same number of slots compared to broadcast exchange thread pool.
@cloud-fan The previous number of subquery broadcast threads is 16, while the default number of broadcast exchange threads is 128.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA removed a comment on pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #29589:
URL: https://github.com/apache/spark/pull/29589#issuecomment-686418822
**[Test build #128255 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/128255/testReport)** for PR 29589 at commit [`1cb65ec`](https://github.com/apache/spark/commit/1cb65ec97fb79b8e52b923a15de1e83759275786).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA removed a comment on pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #29589:
URL: https://github.com/apache/spark/pull/29589#issuecomment-683554366
**[Test build #128072 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/128072/testReport)** for PR 29589 at commit [`9770032`](https://github.com/apache/spark/commit/97700320d270bb5fc7a9e2bcc2e17590b57031ef).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29589:
URL: https://github.com/apache/spark/pull/29589#issuecomment-686587001
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #29589:
URL: https://github.com/apache/spark/pull/29589#discussion_r484691881
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/SubqueryBroadcastExec.scala
##########
@@ -60,10 +63,12 @@ case class SubqueryBroadcastExec(
}
@transient
- private lazy val relationFuture: Future[Array[InternalRow]] = {
+ private lazy val relationFuture: JFuture[Array[InternalRow]] = {
// relationFuture is used in "doExecute". Therefore we can get the execution id correctly here.
val executionId = sparkContext.getLocalProperty(SQLExecution.EXECUTION_ID_KEY)
- Future {
+ SQLExecution.withThreadLocalCaptured[Array[InternalRow]](
Review comment:
let's open a new PR to change the number of threads and discuss there. 16 threads probably are fine, too.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA removed a comment on pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #29589:
URL: https://github.com/apache/spark/pull/29589#issuecomment-685223984
**[Test build #128173 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/128173/testReport)** for PR 29589 at commit [`7d28b53`](https://github.com/apache/spark/commit/7d28b533e2ce21ccd7657ea5f50efb56bc96148a).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] wzhfy commented on a change in pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
wzhfy commented on a change in pull request #29589:
URL: https://github.com/apache/spark/pull/29589#discussion_r484657207
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/SubqueryBroadcastExec.scala
##########
@@ -60,10 +63,12 @@ case class SubqueryBroadcastExec(
}
@transient
- private lazy val relationFuture: Future[Array[InternalRow]] = {
+ private lazy val relationFuture: JFuture[Array[InternalRow]] = {
// relationFuture is used in "doExecute". Therefore we can get the execution id correctly here.
val executionId = sparkContext.getLocalProperty(SQLExecution.EXECUTION_ID_KEY)
- Future {
+ SQLExecution.withThreadLocalCaptured[Array[InternalRow]](
Review comment:
@maropu I think you are right. Sorry I misunderstood your comment previously.
Because in `SubqueryBroadcastExec.relationFuture`, what it really calls is `child.executeBroadcast[HashedRelation]().value`, it should use "broadcast-exchange" threads.
As a result, it seems that propagation for thread local properties in `SubqueryBroadcastExec` is not necessary, they will be propagated by broadcast threads anyway.
BTW, the current test case is also not reasonable, since the udf is not evaluated in the broadcasted part. I moved it to a broadcast filter (like below) and found the above problem. Thanks for pointing this out!
```
test("SPARK-32748: propagate local properties to dynamic pruning thread") {
val factTable = "fact_local_prop_dpp"
val dimTable = "dim_local_prop_dpp"
val filteringValue = 3
def checkPropertyValueByUdfResult(
propKey: String,
propValue: String,
expectedResultCount: Int): Unit = {
spark.sparkContext.setLocalProperty(propKey, propValue)
val df = sql(
s"""
|SELECT f.id
|FROM $factTable f
|INNER JOIN $dimTable s
|ON f.id = s.id
|AND compare_property_value(s.value, '$propKey', '$propValue') = $filteringValue
""".stripMargin)
val subqueryBroadcastSeq = df.queryExecution.executedPlan.flatMap {
case s: FileSourceScanExec => s.partitionFilters.collect {
case DynamicPruningExpression(InSubqueryExec(_, b: SubqueryBroadcastExec, _, _)) => b
}
case _ => Nil
}
assert(subqueryBroadcastSeq.nonEmpty,
s"Should trigger DPP with a reused broadcast exchange:\n${df.queryExecution}")
assert(df.collect().length == expectedResultCount)
}
withTable(factTable, dimTable) {
spark.range(10).select($"id", $"id".as("value"))
.write.partitionBy("id").mode("overwrite").saveAsTable(factTable)
spark.range(5).select($"id", $"id".as("value"))
.write.mode("overwrite").saveAsTable(dimTable)
withSQLConf(
StaticSQLConf.BROADCAST_EXCHANGE_MAX_THREAD_THRESHOLD.key -> "1",
SQLConf.DYNAMIC_PARTITION_PRUNING_ENABLED.key -> "true",
SQLConf.DYNAMIC_PARTITION_PRUNING_REUSE_BROADCAST_ONLY.key -> "true") {
try {
spark.udf.register(
"compare_property_value",
(input: Int, propKey: String, propValue: String) => {
if (TaskContext.get().getLocalProperty(propKey) == propValue) {
filteringValue
} else {
input
}
}
)
val propKey = "spark.sql.subquery.broadcast.prop.key"
// set local property and assert
val propValue1 = UUID.randomUUID().toString()
checkPropertyValueByUdfResult(propKey, propValue1, expectedResultCount = 5)
// change local property and re-assert
val propValue2 = UUID.randomUUID().toString()
checkPropertyValueByUdfResult(propKey, propValue2, expectedResultCount = 5)
} finally {
spark.sessionState.catalog.dropTempFunction("compare_property_value", true)
}
}
}
}
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] wzhfy commented on a change in pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
wzhfy commented on a change in pull request #29589:
URL: https://github.com/apache/spark/pull/29589#discussion_r484657207
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/SubqueryBroadcastExec.scala
##########
@@ -60,10 +63,12 @@ case class SubqueryBroadcastExec(
}
@transient
- private lazy val relationFuture: Future[Array[InternalRow]] = {
+ private lazy val relationFuture: JFuture[Array[InternalRow]] = {
// relationFuture is used in "doExecute". Therefore we can get the execution id correctly here.
val executionId = sparkContext.getLocalProperty(SQLExecution.EXECUTION_ID_KEY)
- Future {
+ SQLExecution.withThreadLocalCaptured[Array[InternalRow]](
Review comment:
@maropu I think you are right. Sorry I misunderstood your comment previously.
Because in `SubqueryBroadcastExec.relationFuture`, what it really calls is `child.executeBroadcast[HashedRelation]().value`, it should use "broadcast-exchange" threads.
As a result, it seems that thread local properties in `SubqueryBroadcastExec` is not necessary, they will be propagated by broadcast threads anyway.
BTW, the current test case is also not reasonable, since the udf is not evaluated in the broadcasted part. I moved it to a filter (like below) and found the above problem. Thanks for pointing this out!
```
test("SPARK-32748: propagate local properties to dynamic pruning thread") {
val factTable = "fact_local_prop_dpp"
val dimTable = "dim_local_prop_dpp"
val filteringValue = 3
def checkPropertyValueByUdfResult(
propKey: String,
propValue: String,
expectedResultCount: Int): Unit = {
spark.sparkContext.setLocalProperty(propKey, propValue)
val df = sql(
s"""
|SELECT f.id
|FROM $factTable f
|INNER JOIN $dimTable s
|ON f.id = s.id
|AND compare_property_value(s.value, '$propKey', '$propValue') = $filteringValue
""".stripMargin)
val subqueryBroadcastSeq = df.queryExecution.executedPlan.flatMap {
case s: FileSourceScanExec => s.partitionFilters.collect {
case DynamicPruningExpression(InSubqueryExec(_, b: SubqueryBroadcastExec, _, _)) => b
}
case _ => Nil
}
assert(subqueryBroadcastSeq.nonEmpty,
s"Should trigger DPP with a reused broadcast exchange:\n${df.queryExecution}")
assert(df.collect().length == expectedResultCount)
}
withTable(factTable, dimTable) {
spark.range(10).select($"id", $"id".as("value"))
.write.partitionBy("id").mode("overwrite").saveAsTable(factTable)
spark.range(5).select($"id", $"id".as("value"))
.write.mode("overwrite").saveAsTable(dimTable)
withSQLConf(
StaticSQLConf.BROADCAST_EXCHANGE_MAX_THREAD_THRESHOLD.key -> "1",
SQLConf.DYNAMIC_PARTITION_PRUNING_ENABLED.key -> "true",
SQLConf.DYNAMIC_PARTITION_PRUNING_REUSE_BROADCAST_ONLY.key -> "true") {
try {
spark.udf.register(
"compare_property_value",
(input: Int, propKey: String, propValue: String) => {
if (TaskContext.get().getLocalProperty(propKey) == propValue) {
filteringValue
} else {
input
}
}
)
val propKey = "spark.sql.subquery.broadcast.prop.key"
// set local property and assert
val propValue1 = UUID.randomUUID().toString()
checkPropertyValueByUdfResult(propKey, propValue1, expectedResultCount = 5)
// change local property and re-assert
val propValue2 = UUID.randomUUID().toString()
checkPropertyValueByUdfResult(propKey, propValue2, expectedResultCount = 5)
} finally {
spark.sessionState.catalog.dropTempFunction("compare_property_value", true)
}
}
}
}
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] wzhfy commented on a change in pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
wzhfy commented on a change in pull request #29589:
URL: https://github.com/apache/spark/pull/29589#discussion_r484657832
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/SubqueryBroadcastExec.scala
##########
@@ -60,10 +63,12 @@ case class SubqueryBroadcastExec(
}
@transient
- private lazy val relationFuture: Future[Array[InternalRow]] = {
+ private lazy val relationFuture: JFuture[Array[InternalRow]] = {
// relationFuture is used in "doExecute". Therefore we can get the execution id correctly here.
val executionId = sparkContext.getLocalProperty(SQLExecution.EXECUTION_ID_KEY)
- Future {
+ SQLExecution.withThreadLocalCaptured[Array[InternalRow]](
Review comment:
@maropu @cloud-fan So should we revert this pr? And raise a separate jira for configuring the number of subquery broadcast thread (maybe use a different config name other than `StaticSQLConf.BROADCAST_EXCHANGE_MAX_THREAD_THRESHOLD`)?
```
object SubqueryBroadcastExec {
private[execution] val executionContext = ExecutionContext.fromExecutorService(
ThreadUtils.newDaemonCachedThreadPool("dynamic-pruning",
SQLConf.get.getConf(StaticSQLConf.BROADCAST_EXCHANGE_MAX_THREAD_THRESHOLD)))
}
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #29589:
URL: https://github.com/apache/spark/pull/29589#issuecomment-685325456
**[Test build #128173 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/128173/testReport)** for PR 29589 at commit [`7d28b53`](https://github.com/apache/spark/commit/7d28b533e2ce21ccd7657ea5f50efb56bc96148a).
* This patch passes all tests.
* This patch merges cleanly.
* This patch adds no public classes.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #29589:
URL: https://github.com/apache/spark/pull/29589#issuecomment-686419413
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #29589:
URL: https://github.com/apache/spark/pull/29589#issuecomment-685223984
**[Test build #128173 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/128173/testReport)** for PR 29589 at commit [`7d28b53`](https://github.com/apache/spark/commit/7d28b533e2ce21ccd7657ea5f50efb56bc96148a).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #29589:
URL: https://github.com/apache/spark/pull/29589#issuecomment-687288302
**[Test build #128302 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/128302/testReport)** for PR 29589 at commit [`2f70782`](https://github.com/apache/spark/commit/2f7078272247f29a8984090240de877e3a88ca96).
* This patch passes all tests.
* This patch merges cleanly.
* This patch adds no public classes.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29589:
URL: https://github.com/apache/spark/pull/29589#issuecomment-687115432
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] wzhfy commented on a change in pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
wzhfy commented on a change in pull request #29589:
URL: https://github.com/apache/spark/pull/29589#discussion_r482897119
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/SubqueryBroadcastExec.scala
##########
@@ -110,5 +115,6 @@ case class SubqueryBroadcastExec(
object SubqueryBroadcastExec {
private[execution] val executionContext = ExecutionContext.fromExecutorService(
- ThreadUtils.newDaemonCachedThreadPool("dynamicpruning", 16))
+ ThreadUtils.newDaemonCachedThreadPool("dynamic-pruning",
+ SQLConf.get.getConf(StaticSQLConf.SUBQUERY_MAX_THREAD_THRESHOLD)))
Review comment:
yes we should use `BROADCAST_EXCHANGE_MAX_THREAD_THRESHOLD`, thanks
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29589:
URL: https://github.com/apache/spark/pull/29589#issuecomment-687283453
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] wzhfy commented on a change in pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
wzhfy commented on a change in pull request #29589:
URL: https://github.com/apache/spark/pull/29589#discussion_r484657832
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/SubqueryBroadcastExec.scala
##########
@@ -60,10 +63,12 @@ case class SubqueryBroadcastExec(
}
@transient
- private lazy val relationFuture: Future[Array[InternalRow]] = {
+ private lazy val relationFuture: JFuture[Array[InternalRow]] = {
// relationFuture is used in "doExecute". Therefore we can get the execution id correctly here.
val executionId = sparkContext.getLocalProperty(SQLExecution.EXECUTION_ID_KEY)
- Future {
+ SQLExecution.withThreadLocalCaptured[Array[InternalRow]](
Review comment:
@maropu @cloud-fan So should we revert this pr? And raise a separate jira for configuring the number of subquery broadcast threads (maybe use a different config name other than `StaticSQLConf.BROADCAST_EXCHANGE_MAX_THREAD_THRESHOLD`)?
```
object SubqueryBroadcastExec {
private[execution] val executionContext = ExecutionContext.fromExecutorService(
ThreadUtils.newDaemonCachedThreadPool("dynamic-pruning",
SQLConf.get.getConf(StaticSQLConf.BROADCAST_EXCHANGE_MAX_THREAD_THRESHOLD)))
}
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] wzhfy commented on a change in pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
wzhfy commented on a change in pull request #29589:
URL: https://github.com/apache/spark/pull/29589#discussion_r483404918
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/DynamicPartitionPruningSuite.scala
##########
@@ -1342,6 +1345,52 @@ abstract class DynamicPartitionPruningSuiteBase
}
}
}
+
+ test("SPARK-32748: propagate local properties to dynamic pruning thread") {
+ def checkPropertyValueByUdfResult(propKey: String, propValue: String): Unit = {
+ spark.sparkContext.setLocalProperty(propKey, propValue)
+ val df = sql(
+ s"""
+ |SELECT compare_property_value(f.date_id, '$propKey', '$propValue') as col
+ |FROM fact_sk f
+ |INNER JOIN dim_store s
+ |ON f.store_id = s.store_id AND s.country = 'NL'
+ """.stripMargin)
+
+ checkPartitionPruningPredicate(df, false, true)
+ assert(df.collect().forall(_.toSeq == Seq(true)))
+ }
+
+ try {
+ SQLConf.get.setConf(StaticSQLConf.BROADCAST_EXCHANGE_MAX_THREAD_THRESHOLD, 1)
Review comment:
Yes you are right.. but it's not because it's a static conf, it's because `executionContext` is in the `SubqueryBroadcastExec` object.
This makes it hard to write unit test. Do you have any suggestion?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] wzhfy commented on a change in pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
wzhfy commented on a change in pull request #29589:
URL: https://github.com/apache/spark/pull/29589#discussion_r483586003
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/DynamicPartitionPruningSuite.scala
##########
@@ -1342,6 +1345,52 @@ abstract class DynamicPartitionPruningSuiteBase
}
}
}
+
+ test("SPARK-32748: propagate local properties to dynamic pruning thread") {
+ def checkPropertyValueByUdfResult(propKey: String, propValue: String): Unit = {
+ spark.sparkContext.setLocalProperty(propKey, propValue)
+ val df = sql(
+ s"""
+ |SELECT compare_property_value(f.date_id, '$propKey', '$propValue') as col
+ |FROM fact_sk f
+ |INNER JOIN dim_store s
+ |ON f.store_id = s.store_id AND s.country = 'NL'
+ """.stripMargin)
+
+ checkPartitionPruningPredicate(df, false, true)
+ assert(df.collect().forall(_.toSeq == Seq(true)))
+ }
+
+ try {
+ SQLConf.get.setConf(StaticSQLConf.BROADCAST_EXCHANGE_MAX_THREAD_THRESHOLD, 1)
Review comment:
Thanks for the advice! Updated.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #29589:
URL: https://github.com/apache/spark/pull/29589#discussion_r484669025
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/SubqueryBroadcastExec.scala
##########
@@ -60,10 +63,12 @@ case class SubqueryBroadcastExec(
}
@transient
- private lazy val relationFuture: Future[Array[InternalRow]] = {
+ private lazy val relationFuture: JFuture[Array[InternalRow]] = {
// relationFuture is used in "doExecute". Therefore we can get the execution id correctly here.
val executionId = sparkContext.getLocalProperty(SQLExecution.EXECUTION_ID_KEY)
- Future {
+ SQLExecution.withThreadLocalCaptured[Array[InternalRow]](
Review comment:
oh, then please revert it.
I don't think we need a separate config. The thread pool here is used to wait for the broadcast to finish, seems better to have same number of slots compared to broadcast exchange thread pool.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #29589:
URL: https://github.com/apache/spark/pull/29589#issuecomment-687118830
**[Test build #128303 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/128303/testReport)** for PR 29589 at commit [`aabc23f`](https://github.com/apache/spark/commit/aabc23f054d2d988d50c123269046f9cd8453af8).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #29589:
URL: https://github.com/apache/spark/pull/29589#issuecomment-687119374
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #29589:
URL: https://github.com/apache/spark/pull/29589#issuecomment-683554366
**[Test build #128072 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/128072/testReport)** for PR 29589 at commit [`9770032`](https://github.com/apache/spark/commit/97700320d270bb5fc7a9e2bcc2e17590b57031ef).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #29589:
URL: https://github.com/apache/spark/pull/29589#issuecomment-686418822
**[Test build #128255 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/128255/testReport)** for PR 29589 at commit [`1cb65ec`](https://github.com/apache/spark/commit/1cb65ec97fb79b8e52b923a15de1e83759275786).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] wzhfy commented on a change in pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
wzhfy commented on a change in pull request #29589:
URL: https://github.com/apache/spark/pull/29589#discussion_r484657207
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/SubqueryBroadcastExec.scala
##########
@@ -60,10 +63,12 @@ case class SubqueryBroadcastExec(
}
@transient
- private lazy val relationFuture: Future[Array[InternalRow]] = {
+ private lazy val relationFuture: JFuture[Array[InternalRow]] = {
// relationFuture is used in "doExecute". Therefore we can get the execution id correctly here.
val executionId = sparkContext.getLocalProperty(SQLExecution.EXECUTION_ID_KEY)
- Future {
+ SQLExecution.withThreadLocalCaptured[Array[InternalRow]](
Review comment:
@maropu I think you are right. Sorry I misunderstood your comment previously.
Because in `SubqueryBroadcastExec.relationFuture`, what it really calls is `child.executeBroadcast[HashedRelation]().value`, it should use "broadcast-exchange" threads.
As a result, it seems that propagation for thread local properties in `SubqueryBroadcastExec` is not necessary, they will be propagated by broadcast threads anyway.
BTW, the current test case is also not reasonable, since the udf is not evaluated in the broadcasted part. I moved it to a filter (like below) and found the above problem. Thanks for pointing this out!
```
test("SPARK-32748: propagate local properties to dynamic pruning thread") {
val factTable = "fact_local_prop_dpp"
val dimTable = "dim_local_prop_dpp"
val filteringValue = 3
def checkPropertyValueByUdfResult(
propKey: String,
propValue: String,
expectedResultCount: Int): Unit = {
spark.sparkContext.setLocalProperty(propKey, propValue)
val df = sql(
s"""
|SELECT f.id
|FROM $factTable f
|INNER JOIN $dimTable s
|ON f.id = s.id
|AND compare_property_value(s.value, '$propKey', '$propValue') = $filteringValue
""".stripMargin)
val subqueryBroadcastSeq = df.queryExecution.executedPlan.flatMap {
case s: FileSourceScanExec => s.partitionFilters.collect {
case DynamicPruningExpression(InSubqueryExec(_, b: SubqueryBroadcastExec, _, _)) => b
}
case _ => Nil
}
assert(subqueryBroadcastSeq.nonEmpty,
s"Should trigger DPP with a reused broadcast exchange:\n${df.queryExecution}")
assert(df.collect().length == expectedResultCount)
}
withTable(factTable, dimTable) {
spark.range(10).select($"id", $"id".as("value"))
.write.partitionBy("id").mode("overwrite").saveAsTable(factTable)
spark.range(5).select($"id", $"id".as("value"))
.write.mode("overwrite").saveAsTable(dimTable)
withSQLConf(
StaticSQLConf.BROADCAST_EXCHANGE_MAX_THREAD_THRESHOLD.key -> "1",
SQLConf.DYNAMIC_PARTITION_PRUNING_ENABLED.key -> "true",
SQLConf.DYNAMIC_PARTITION_PRUNING_REUSE_BROADCAST_ONLY.key -> "true") {
try {
spark.udf.register(
"compare_property_value",
(input: Int, propKey: String, propValue: String) => {
if (TaskContext.get().getLocalProperty(propKey) == propValue) {
filteringValue
} else {
input
}
}
)
val propKey = "spark.sql.subquery.broadcast.prop.key"
// set local property and assert
val propValue1 = UUID.randomUUID().toString()
checkPropertyValueByUdfResult(propKey, propValue1, expectedResultCount = 5)
// change local property and re-assert
val propValue2 = UUID.randomUUID().toString()
checkPropertyValueByUdfResult(propKey, propValue2, expectedResultCount = 5)
} finally {
spark.sessionState.catalog.dropTempFunction("compare_property_value", true)
}
}
}
}
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] maropu commented on a change in pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #29589:
URL: https://github.com/apache/spark/pull/29589#discussion_r484271453
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/SubqueryBroadcastExec.scala
##########
@@ -60,10 +63,12 @@ case class SubqueryBroadcastExec(
}
@transient
- private lazy val relationFuture: Future[Array[InternalRow]] = {
+ private lazy val relationFuture: JFuture[Array[InternalRow]] = {
// relationFuture is used in "doExecute". Therefore we can get the execution id correctly here.
val executionId = sparkContext.getLocalProperty(SQLExecution.EXECUTION_ID_KEY)
- Future {
+ SQLExecution.withThreadLocalCaptured[Array[InternalRow]](
Review comment:
Looks the added test can pass without this fix (I think [the comment](https://github.com/apache/spark/pull/29589#discussion_r482989813) seems to be related to this issue). Could you check this again? @wzhfy
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] wzhfy commented on a change in pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
wzhfy commented on a change in pull request #29589:
URL: https://github.com/apache/spark/pull/29589#discussion_r484605375
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/SubqueryBroadcastExec.scala
##########
@@ -60,10 +63,12 @@ case class SubqueryBroadcastExec(
}
@transient
- private lazy val relationFuture: Future[Array[InternalRow]] = {
+ private lazy val relationFuture: JFuture[Array[InternalRow]] = {
// relationFuture is used in "doExecute". Therefore we can get the execution id correctly here.
val executionId = sparkContext.getLocalProperty(SQLExecution.EXECUTION_ID_KEY)
- Future {
+ SQLExecution.withThreadLocalCaptured[Array[InternalRow]](
Review comment:
sure, I'll check
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] hvanhovell commented on a change in pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
hvanhovell commented on a change in pull request #29589:
URL: https://github.com/apache/spark/pull/29589#discussion_r486137970
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/SubqueryBroadcastExec.scala
##########
@@ -60,10 +63,12 @@ case class SubqueryBroadcastExec(
}
@transient
- private lazy val relationFuture: Future[Array[InternalRow]] = {
+ private lazy val relationFuture: JFuture[Array[InternalRow]] = {
// relationFuture is used in "doExecute". Therefore we can get the execution id correctly here.
val executionId = sparkContext.getLocalProperty(SQLExecution.EXECUTION_ID_KEY)
- Future {
+ SQLExecution.withThreadLocalCaptured[Array[InternalRow]](
Review comment:
It would be good if we can set this flag.
@wzhfy @maropu @cloud-fan sorry if I am late to the party. We should consider keeping this. It is generally good practice to use a narrow waist for these things in the code. It will save someone in the future some time debugging why his change is not working :).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #29589:
URL: https://github.com/apache/spark/pull/29589#issuecomment-687282516
**[Test build #128303 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/128303/testReport)** for PR 29589 at commit [`aabc23f`](https://github.com/apache/spark/commit/aabc23f054d2d988d50c123269046f9cd8453af8).
* This patch passes all tests.
* This patch merges cleanly.
* This patch adds no public classes.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #29589:
URL: https://github.com/apache/spark/pull/29589#issuecomment-687114582
**[Test build #128302 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/128302/testReport)** for PR 29589 at commit [`2f70782`](https://github.com/apache/spark/commit/2f7078272247f29a8984090240de877e3a88ca96).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #29589:
URL: https://github.com/apache/spark/pull/29589#issuecomment-683603237
**[Test build #128072 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/128072/testReport)** for PR 29589 at commit [`9770032`](https://github.com/apache/spark/commit/97700320d270bb5fc7a9e2bcc2e17590b57031ef).
* This patch **fails due to an unknown error code, -9**.
* This patch merges cleanly.
* This patch adds no public classes.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29589:
URL: https://github.com/apache/spark/pull/29589#issuecomment-687119374
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #29589:
URL: https://github.com/apache/spark/pull/29589#discussion_r483448021
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/DynamicPartitionPruningSuite.scala
##########
@@ -1342,6 +1345,52 @@ abstract class DynamicPartitionPruningSuiteBase
}
}
}
+
+ test("SPARK-32748: propagate local properties to dynamic pruning thread") {
+ def checkPropertyValueByUdfResult(propKey: String, propValue: String): Unit = {
+ spark.sparkContext.setLocalProperty(propKey, propValue)
+ val df = sql(
+ s"""
+ |SELECT compare_property_value(f.date_id, '$propKey', '$propValue') as col
+ |FROM fact_sk f
+ |INNER JOIN dim_store s
+ |ON f.store_id = s.store_id AND s.country = 'NL'
+ """.stripMargin)
+
+ checkPartitionPruningPredicate(df, false, true)
+ assert(df.collect().forall(_.toSeq == Seq(true)))
+ }
+
+ try {
+ SQLConf.get.setConf(StaticSQLConf.BROADCAST_EXCHANGE_MAX_THREAD_THRESHOLD, 1)
Review comment:
Actually it was the same before: https://github.com/apache/spark/pull/27266/files#diff-6dabaf3c491be73cc0479b1f368d157bR164
Can we move this test to there? Then it's easier to read as these special tests are put together.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #29589:
URL: https://github.com/apache/spark/pull/29589#issuecomment-687289237
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA removed a comment on pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #29589:
URL: https://github.com/apache/spark/pull/29589#issuecomment-687114582
**[Test build #128302 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/128302/testReport)** for PR 29589 at commit [`2f70782`](https://github.com/apache/spark/commit/2f7078272247f29a8984090240de877e3a88ca96).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] maropu commented on a change in pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #29589:
URL: https://github.com/apache/spark/pull/29589#discussion_r484271453
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/SubqueryBroadcastExec.scala
##########
@@ -60,10 +63,12 @@ case class SubqueryBroadcastExec(
}
@transient
- private lazy val relationFuture: Future[Array[InternalRow]] = {
+ private lazy val relationFuture: JFuture[Array[InternalRow]] = {
// relationFuture is used in "doExecute". Therefore we can get the execution id correctly here.
val executionId = sparkContext.getLocalProperty(SQLExecution.EXECUTION_ID_KEY)
- Future {
+ SQLExecution.withThreadLocalCaptured[Array[InternalRow]](
Review comment:
Looks the added test can pass without this fix. Could you check this again? @wzhfy
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA removed a comment on pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #29589:
URL: https://github.com/apache/spark/pull/29589#issuecomment-687118830
**[Test build #128303 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/128303/testReport)** for PR 29589 at commit [`aabc23f`](https://github.com/apache/spark/commit/aabc23f054d2d988d50c123269046f9cd8453af8).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #29589:
URL: https://github.com/apache/spark/pull/29589#issuecomment-683554740
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] maropu commented on a change in pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #29589:
URL: https://github.com/apache/spark/pull/29589#discussion_r482989813
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/DynamicPartitionPruningSuite.scala
##########
@@ -1342,6 +1345,52 @@ abstract class DynamicPartitionPruningSuiteBase
}
}
}
+
+ test("SPARK-32748: propagate local properties to dynamic pruning thread") {
+ def checkPropertyValueByUdfResult(propKey: String, propValue: String): Unit = {
+ spark.sparkContext.setLocalProperty(propKey, propValue)
+ val df = sql(
+ s"""
+ |SELECT compare_property_value(f.date_id, '$propKey', '$propValue') as col
Review comment:
Is `compare_property_value` really evaluated in `SubqueryBroadcastExec` threads?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan closed pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
cloud-fan closed pull request #29589:
URL: https://github.com/apache/spark/pull/29589
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29589:
URL: https://github.com/apache/spark/pull/29589#issuecomment-683603505
Merged build finished. Test FAILed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] wzhfy commented on pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
wzhfy commented on pull request #29589:
URL: https://github.com/apache/spark/pull/29589#issuecomment-683554482
cc @cloud-fan @maryannxue @ajithme
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] maropu commented on a change in pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #29589:
URL: https://github.com/apache/spark/pull/29589#discussion_r484669248
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/SubqueryBroadcastExec.scala
##########
@@ -60,10 +63,12 @@ case class SubqueryBroadcastExec(
}
@transient
- private lazy val relationFuture: Future[Array[InternalRow]] = {
+ private lazy val relationFuture: JFuture[Array[InternalRow]] = {
// relationFuture is used in "doExecute". Therefore we can get the execution id correctly here.
val executionId = sparkContext.getLocalProperty(SQLExecution.EXECUTION_ID_KEY)
- Future {
+ SQLExecution.withThreadLocalCaptured[Array[InternalRow]](
Review comment:
sgtm
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #29589:
URL: https://github.com/apache/spark/pull/29589#discussion_r482929915
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/DynamicPartitionPruningSuite.scala
##########
@@ -1342,6 +1345,52 @@ abstract class DynamicPartitionPruningSuiteBase
}
}
}
+
+ test("SPARK-32748: propagate local properties to dynamic pruning thread") {
+ def checkPropertyValueByUdfResult(propKey: String, propValue: String): Unit = {
+ spark.sparkContext.setLocalProperty(propKey, propValue)
+ val df = sql(
+ s"""
+ |SELECT compare_property_value(f.date_id, '$propKey', '$propValue') as col
+ |FROM fact_sk f
+ |INNER JOIN dim_store s
+ |ON f.store_id = s.store_id AND s.country = 'NL'
+ """.stripMargin)
+
+ checkPartitionPruningPredicate(df, false, true)
+ assert(df.collect().forall(_.toSeq == Seq(true)))
+ }
+
+ try {
+ SQLConf.get.setConf(StaticSQLConf.BROADCAST_EXCHANGE_MAX_THREAD_THRESHOLD, 1)
Review comment:
does this really work? It's a static conf. As long as there is an earlier test triggers DPP, this won't work.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #29589:
URL: https://github.com/apache/spark/pull/29589#issuecomment-685326788
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29589:
URL: https://github.com/apache/spark/pull/29589#issuecomment-683603513
Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/128072/
Test FAILed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #29589:
URL: https://github.com/apache/spark/pull/29589#discussion_r481642185
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/DynamicPartitionPruningSuite.scala
##########
@@ -1342,6 +1345,50 @@ abstract class DynamicPartitionPruningSuiteBase
}
}
}
+
+ test("SPARK-32748: propagate local properties to dynamic pruning thread") {
+ def checkPropertyValueByUdfResult(propKey: String, propValue: String): Unit = {
+ spark.sparkContext.setLocalProperty(propKey, propValue)
+ val df = sql(
+ s"""
+ |SELECT compare_property_value(f.date_id, '$propKey', '$propValue') as col
+ |FROM fact_sk f
+ |INNER JOIN dim_store s
+ |ON f.store_id = s.store_id AND s.country = 'NL'
+ """.stripMargin)
+
+ checkPartitionPruningPredicate(df, false, true)
+ assert(df.collect().forall(_.toSeq == Seq(true)))
+ }
+
+ try {
+ SQLConf.get.setConf(StaticSQLConf.SUBQUERY_MAX_THREAD_THRESHOLD, 1)
+
+ withSQLConf(
+ SQLConf.DYNAMIC_PARTITION_PRUNING_ENABLED.key -> "true",
+ SQLConf.DYNAMIC_PARTITION_PRUNING_REUSE_BROADCAST_ONLY.key -> "true") {
+
+ spark.udf.register(
+ "compare_property_value",
+ (input: Int, propKey: String, propValue: String) =>
+ TaskContext.get().getLocalProperty(propKey) == propValue
+ )
+ val propKey = "spark.sql.subquery.broadcast.prop.key"
+
+ // set local property and assert
+ val propValue1 = UUID.randomUUID().toString()
+ checkPropertyValueByUdfResult(propKey, propValue1)
+
+ // change local property and re-assert
+ val propValue2 = UUID.randomUUID().toString()
+ checkPropertyValueByUdfResult(propKey, propValue2)
+
+ spark.sessionState.catalog.dropTempFunction("compare_property_value", false)
Review comment:
shall we put it in `finally`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #29589:
URL: https://github.com/apache/spark/pull/29589#issuecomment-687283453
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29589:
URL: https://github.com/apache/spark/pull/29589#issuecomment-683554740
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #29589: [SPARK-32748][SQL] Support local property propagation in SubqueryBroadcastExec
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #29589:
URL: https://github.com/apache/spark/pull/29589#issuecomment-687289237
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org