-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-13306] [SQL] uncorrelated scalar subquery #11190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
0665a69
236ac88
016c36c
a4bae33
d0974cf
3a8f08d
7596173
0034172
e082845
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,7 +21,7 @@ import java.util.concurrent.atomic.AtomicBoolean | |
|
|
||
| import scala.collection.mutable.ArrayBuffer | ||
| import scala.concurrent.{Await, ExecutionContext, Future} | ||
| import scala.concurrent.duration.Duration | ||
| import scala.concurrent.duration._ | ||
|
|
||
| import org.apache.spark.Logging | ||
| import org.apache.spark.rdd.{RDD, RDDOperationScope} | ||
|
|
@@ -139,10 +139,19 @@ abstract class SparkPlan extends QueryPlan[SparkPlan] with Logging with Serializ | |
|
|
||
| children.foreach(_.prepare()) | ||
|
|
||
| val timeout: Duration = { | ||
| val timeoutValue = sqlContext.conf.broadcastTimeout | ||
| if (timeoutValue < 0) { | ||
| Duration.Inf | ||
| } else { | ||
| timeoutValue.seconds | ||
| } | ||
| } | ||
|
|
||
| // fill in the result of subqueries | ||
| queryResults.foreach { | ||
| case (e, futureResult) => | ||
| val rows = Await.result(futureResult, Duration.Inf) | ||
| val rows = Await.result(futureResult, timeout) | ||
|
||
| if (rows.length > 1) { | ||
| sys.error(s"Scalar subquery should return at most one row, but got ${rows.length}: " + | ||
|
||
| s"${e.query.treeString}") | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should move the blocking phase into execute, otherwise if multiple nodes have subqueries, it becomes blocking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah ok you can't have a general execute.
I guess this is why some query engines have init and then prepare.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or a subquery is now blocking broadcasting ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is called after
doPrepare(), and after prepare() of it's children, so it will NOT block broadcasting (will happen in the same time).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if there is a broadcast join after this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Broadcast will be issued before this.