-
Notifications
You must be signed in to change notification settings - Fork 442
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
[CORE] Support submit subqueries concurrently to improve scalar subquery performance #1097
Conversation
Thanks for opening a pull request! Could you open an issue for this pull request on Github Issues? https://github.com/oap-project/gluten/issues Then could you also rename commit message and pull request title in the following format?
See also: |
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.
Thank you. I have a question on the validation parameter.
gluten-core/src/main/scala/io/glutenproject/execution/BasicScanExecTransformer.scala
Outdated
Show resolved
Hide resolved
// the first column in first row from `query`. | ||
val rows = query.plan.executeCollect() | ||
if (rows.length > 1) { | ||
sys.error(s"more than one row returned by a subquery used as an expression:\n${query.plan}") |
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.
Throw runtime exception
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.
Done
@@ -26,7 +26,7 @@ import org.apache.spark.sql.catalyst.optimizer.NormalizeNaNAndZero | |||
import org.apache.spark.sql.execution._ | |||
import org.apache.spark.sql.execution.exchange.BroadcastExchangeExec | |||
|
|||
object ExpressionConverter extends Logging { | |||
case class ExpressionConverter(validation: Boolean) extends Logging { |
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.
Can we add some notes here for parameter validation
? By looking into ExpressionConverter's code one doesn't realize where validation is happened.
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.
add a comment here
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.
Thanks!
hi @WangGuangxin, can you please do a rebase? |
Can one of the admins verify this patch? |
ok |
@WangGuangxin, could you please update this patch? |
ok |
Run Gluten Clickhouse CI |
…ion when do native validation
04dda75
to
ff1e993
Compare
Run Gluten Clickhouse CI |
1 similar comment
Run Gluten Clickhouse CI |
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 changes were proposed in this pull request?
In this MR, I proposed the following two changes to improve subquery performance.
WholeStageTransformerExec.doWholestageTransform
, invokeSparkPlan.prepare
to trigger Subquery execution concurrently before we do expression transform.Currently, subquery is supported in
ScalarSubqueryTransformer.doTransform
, by invokingScalarSbuquery.plan.executeCollect
, which will block the whole code path before the subquery really returns.But in vanilla spark, subquery is submitted concurrently in
SparkPlan.prepare
,so that we can fully utilize spark cores.Take TPC-DS Q9 as an example,
vanilla spark submits subquery calculation concurrently,
while gluten submits subquery one by one
How was this patch tested?
It's tested against TPC-DS 1T Q9
before this patch, it costs 5.3min, after this patch cost 39s