-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-21726][SQL] Check for structural integrity of the plan in Optimzer in test mode. #18956
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9170ceb
Check for structural integrity of the plan in Optimzer in test mode.
viirya c99011d
Address comment.
viirya 0af1efb
Merge remote-tracking branch 'upstream/master' into SPARK-21726
viirya e1e4aa1
Merge remote-tracking branch 'upstream/master' into SPARK-21726
viirya 959e315
We should analyze the plan for evaluating expression before optimizat…
viirya ecdfb7d
Address comments.
viirya File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Address comment.
- Loading branch information
commit c99011ddbf60ae104cb91c578d56c971e6b87c86
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -64,12 +64,12 @@ abstract class RuleExecutor[TreeType <: TreeNode[_]] extends Logging { | |
| protected def batches: Seq[Batch] | ||
|
|
||
| /** | ||
| * Defines a check function which checks for structural integrity of the plan in test mode after | ||
| * the execution 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 | ||
| * returns `false` if the given plan doesn't pass the structural integrity check. | ||
| * Defines a check function which checks for structural integrity of the plan after the execution | ||
| * 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. | ||
| */ | ||
| protected def planChecker: Option[TreeType => Boolean] = None | ||
| protected def planChecker(plan: TreeType): Boolean = true | ||
|
|
||
| /** | ||
| * Executes the batches of rules defined by the subclass. The batches are executed serially | ||
|
|
@@ -101,8 +101,8 @@ abstract class RuleExecutor[TreeType <: TreeNode[_]] extends Logging { | |
| """.stripMargin) | ||
| } | ||
|
|
||
| // In test mode, run the structural integrity checker against the plan after each rule. | ||
| if (Utils.isTesting && !planChecker.map(_.apply(result)).getOrElse(true)) { | ||
| // Run the structural integrity checker against the plan after each rule. | ||
| 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) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. move the exception throwing logics into the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nvm. The message also has rule and batch names. |
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
planChecker->isPlanIntegral?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.
Looks good.