You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/04/07 05:42:12 UTC

[GitHub] [spark] imback82 commented on a change in pull request #32032: [SPARK-34701][SQL] Introduce AnalysisOnlyCommand that allows its children to be removed once the command is marked as analyzed.

imback82 commented on a change in pull request #32032:
URL: https://github.com/apache/spark/pull/32032#discussion_r608354169



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/Command.scala
##########
@@ -37,3 +38,35 @@ trait Command extends LogicalPlan {
 trait LeafCommand extends Command with LeafLike[LogicalPlan]
 trait UnaryCommand extends Command with UnaryLike[LogicalPlan]
 trait BinaryCommand extends Command with BinaryLike[LogicalPlan]
+
+/**
+ * A logical node that represents a command whose children are only analyzed, but not optimized.
+ */
+trait AnalysisOnlyCommand extends Command {
+  private var _isAnalyzed: Boolean = false
+
+  def childrenToAnalyze: Seq[LogicalPlan]
+
+  override def children: Seq[LogicalPlan] = if (_isAnalyzed) Nil else childrenToAnalyze

Review comment:
       Hmm, I don't think we can use case class at this level (e.g., cannot have abstract member like `childrenToAnalyze`), right?
   
   If we need to make the node immutable, I think the responsibility should be at the concrete command - similar to the first commit I had?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org