Uh oh!
There was an error while loading. Please reload this page.
[SPARK-21726][SQL] Check for structural integrity of the plan in Optimzer in test mode. - #18956
[SPARK-21726][SQL] Check for structural integrity of the plan in Optimzer in test mode.#18956viirya wants to merge 6 commits into
Conversation
| // Check for structural integrity of the plan in test mode. Currently we only check if a plan is | ||
| // still resolved after the execution of each rule. | ||
| override protected def planChecker: Option[LogicalPlan => Boolean] = Some( |
There was a problem hiding this comment.
can we move the checking of whether this is a test in here, then this method simply returns boolean, and by default it returns true.
SparkQA
commented
Aug 16, 2017
Test build #80715 has finished for PR 18956 at commit
|
SparkQA
commented
Aug 16, 2017
Test build #80717 has finished for PR 18956 at commit
|
SparkQA
commented
Aug 16, 2017
Test build #80718 has finished for PR 18956 at commit
|
viirya
commented
Aug 16, 2017
Interesting, existing |
The reason The query causing the problem in The optimized plan looks like: Before Currently the After the rule, the subquery looks like: Notice Because The unresolved By modifying |
The PR going to fix the issue described in #18956 (comment) is submitted at #18968. |
viirya
commented
Aug 24, 2017
retest this please. |
viirya
commented
Aug 24, 2017
#18968 is merged. This should pass the tests now. |
SparkQA
commented
Aug 24, 2017
Test build #81079 has finished for PR 18956 at commit
|
viirya
commented
Aug 25, 2017
Seems there are other issues caused by |
viirya
commented
Aug 25, 2017
I submitted #19050 to fix it. |
#19050 is merged now. Let's see if there still is any rule can fail this structural integrity check. |
viirya
commented
Sep 6, 2017
retest this please. |
SparkQA
commented
Sep 6, 2017
Test build #81460 has finished for PR 18956 at commit
|
SparkQA
commented
Sep 7, 2017
Test build #81496 has finished for PR 18956 at commit
|
viirya
commented
Sep 7, 2017
retest this please. |
SparkQA
commented
Sep 7, 2017
Test build #81504 has finished for PR 18956 at commit
|
SparkQA
commented
Sep 7, 2017
Test build #81518 has finished for PR 18956 at commit
|
| if (!planChecker(result)) { | ||
| val message = s"After applying rule ${rule.ruleName} in batch ${batch.name}, " + | ||
| "the structural integrity of the plan is broken." | ||
| throw new TreeNodeException(result, message, null) |
There was a problem hiding this comment.
move the exception throwing logics into the planChecker ?
There was a problem hiding this comment.
nvm. The message also has rule and batch names.
| import org.apache.spark.sql.internal.SQLConf | ||
| class OptimizerSICheckerkSuite extends PlanTest { |
There was a problem hiding this comment.
-> OptimizerStructuralIntegrityCheckerkSuite
| * of each rule. For example, we can check whether a plan is still resolved after each rule in | ||
| * `Optimizer`, so we can catch rules that return invalid plans. The check function will returns | ||
| * `false` if the given plan doesn't pass the structural integrity check. | ||
| */ |
gatorsmile
commented
Sep 7, 2017
LGTM except two minor comments |
SparkQA
commented
Sep 8, 2017
Test build #81529 has finished for PR 18956 at commit
|
SparkQA
commented
Sep 8, 2017
Test build #81531 has finished for PR 18956 at commit
|
gatorsmile
commented
Sep 8, 2017
Thanks! Merged to master. |
viirya
commented
Sep 8, 2017
Thanks @rxin@gatorsmile |
What changes were proposed in this pull request?
We have many optimization rules now in
Optimzer. Right now we don't have any checks in the optimizer to check for the structural integrity of the plan (e.g. resolved). When debugging, it is difficult to identify which rules return invalid plans.It would be great if in test mode, we can check whether a plan is still resolved after the execution of each rule, so we can catch rules that return invalid plans.
How was this patch tested?
Added tests.