hvanhovell commented on a change in pull request #24915: [SPARK-28096][SQL] 
Convert defs to lazy vals to avoid expensive `output` computation in QueryPlans
URL: https://github.com/apache/spark/pull/24915#discussion_r296194692
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/basicLogicalOperators.scala
 ##########
 @@ -934,7 +952,8 @@ object Limit {
  * See [[Limit]] for more information.
  */
 case class GlobalLimit(limitExpr: Expression, child: LogicalPlan) extends 
OrderPreservingUnaryNode {
-  override def output: Seq[Attribute] = child.output
+  @transient
+  override lazy val output: Seq[Attribute] = child.output
 
 Review comment:
   Yes, I mean simple cases like this. Even if this regresses slightly then I 
am still in favor of doing it like this. The reason being is that lazy vals are 
not free, they require memory and synchronization.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to