This is an automated email from the ASF dual-hosted git repository.
wenchen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push:
new 9bebf4b36cd [MINOR][SQL] Document AnalysisOnlyCommand
9bebf4b36cd is described below
commit 9bebf4b36cdfc85e2ae53c448ea9fc1bf1f0f843
Author: Reynold Xin <[email protected]>
AuthorDate: Mon Dec 26 13:31:12 2022 +0800
[MINOR][SQL] Document AnalysisOnlyCommand
### What changes were proposed in this pull request?
This patch adds more documentation to AnalysisOnlyCommand, since it's not
obvious why it's needed or how it works.
### Why are the changes needed?
See above.
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
N/A
Closes #39199 from rxin/AnalysisOnlyCommand_comment.
Authored-by: Reynold Xin <[email protected]>
Signed-off-by: Wenchen Fan <[email protected]>
---
.../org/apache/spark/sql/catalyst/plans/logical/Command.scala | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/Command.scala
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/Command.scala
index 8e23c2ea0e2..fc9eb5d03e4 100644
---
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/Command.scala
+++
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/Command.scala
@@ -44,7 +44,15 @@ trait BinaryCommand extends Command with
BinaryLike[LogicalPlan]
/**
* A logical node that can be used for a command that requires its children to
be only analyzed,
- * but not optimized.
+ * but not optimized. An example would be "create view": we don't need to
optimize the view subtree
+ * because we will just store the entire view text as is in the catalog.
+ *
+ * The way we do this is by setting the children to empty once the subtree is
analyzed. This will
+ * prevent the optimizer (or the analyzer from that point on) from traversing
into the children.
+ *
+ * There's a corresponding rule
+ * [[org.apache.spark.sql.catalyst.analysis.Analyzer.HandleSpecialCommand]]
that marks these
+ * commands analyzed.
*/
trait AnalysisOnlyCommand extends Command {
val isAnalyzed: Boolean
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]