Uh oh!
There was an error while loading. Please reload this page.
[SPARK-23229][SQL] Dataset.hint should use planWithBarrier logical plan - #20405
[SPARK-23229][SQL] Dataset.hint should use planWithBarrier logical plan#20405jaceklaskowski wants to merge 1 commit into
Conversation
jaceklaskowski
commented
Jan 26, 2018
/cc @cloud-fan |
| @scala.annotation.varargs | ||
| def hint(name: String, parameters: Any*): Dataset[T] = withTypedPlan { | ||
| UnresolvedHint(name, parameters, logicalPlan) | ||
| UnresolvedHint(name, parameters, planWithBarrier) |
There was a problem hiding this comment.
I think ResolveBroadcastHints rule will traverse recursively the children of logical plan. If we wrap it with a barrier, we can't be traverse down the tree.
There was a problem hiding this comment.
My understanding however is that planWithBarrier is already analyzed (and ResolveBroadcastHints as the very first rule had its chance to do its work). That's the extra processing hint does every time it's called. Using planWithBarrier makes it less "painful".
Just use hint twice and see the analyzed plan.
There was a problem hiding this comment.
I think @viirya has a valid concern. think about
val df1 = spark.table("t").select("id")
df1.hint("broadcast", "t")
We should transform down the plan of df1, find the bottom table relation and apply the hint.
There was a problem hiding this comment.
I thought that that's what ResolveBroadcastHints does --> https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveHints.scala#L93-L101, doesn't it? I'm going to write a test case for it to confirm (and that's what I was asking for in the email to dev@spark the other day).
There was a problem hiding this comment.
@jaceklaskowski Because the logical plan is wrapped in analysis barrier, ResolveBroadcastHints can't traverse down it to reach the UnresolvedRelation/SubqueryAlias. at https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveHints.scala#L60-L61.
There was a problem hiding this comment.
a possible workaround is to explicitly go through the barrier in the hint resolution rules, so that we can still use barrier here and skip analysis in other analyzer rules.
There was a problem hiding this comment.
shall we go with this workaround?
SparkQA
commented
Jan 26, 2018
Test build #86702 has finished for PR 20405 at commit
|
jaceklaskowski
commented
Jan 26, 2018
Looks like the tests failed due to "java.io.IOException: Failed to delete: /home/jenkins/workspace/SparkPullRequestBuilder/target/tmp/spark-5a9b5811-306d-4ba0-8bfb-9e263ddf47b8" Is this because of the change or a "misnomer"? |
HyukjinKwon
commented
Jul 16, 2018
retest this please |
SparkQA
commented
Jul 16, 2018
Test build #93078 has finished for PR 20405 at commit
|
gatorsmile
commented
Jul 16, 2018
@HyukjinKwon Does the existing AnalysisBarrier introduce a regression when users use the hint like |
viirya
commented
Jul 16, 2018
When we use a hint an analyzed plan goes through analysis again. If I remember it correctly it is happened before analysis barrier is introduced. This PR wants to wrap an AnalysisBarrier on it so we won't re-analyze it. |
SparkQA
commented
Jul 25, 2018
Test build #93559 has finished for PR 20405 at commit
|
I think this can be closed in favor of #21822 |
dongjoon-hyun
commented
Sep 11, 2018
Hi, @jaceklaskowski . Could you close this PR? |
dongjoon-hyun
commented
Sep 16, 2018
Gentle ping, @jaceklaskowski . |
maropu
commented
Sep 18, 2018
kindly ping |
HyukjinKwon
commented
Sep 27, 2018
ping @jaceklaskowski |
dongjoon-hyun
commented
Oct 2, 2018
@jaceklaskowski seems to ignore Git messages here. Should we ping him email since he is Spark dev mailing list? |
felixcheung
commented
Oct 2, 2018
probably. |
Closesapache#22567Closesapache#18457Closesapache#21517Closesapache#21858Closesapache#22383Closesapache#19219Closesapache#22401Closesapache#22811Closesapache#20405Closesapache#21933Closesapache#22819 from srowen/ClosePRs. Authored-by: Sean Owen <sean.owen@databricks.com> Signed-off-by: Sean Owen <sean.owen@databricks.com>
What changes were proposed in this pull request?
Every time
Dataset.hintis used it triggers execution of logical commands, their unions and hint resolution (among other things that analyzer does).hintshould useplanWithBarrierinstead.Fixes https://issues.apache.org/jira/browse/SPARK-23229
How was this patch tested?
Existing unit tests, local build + awaiting Jenkins