hvanhovell commented on a change in pull request #24866: [SPARK-28096][SQL] 
Convert defs to lazy vals to avoid expensive reference computation in QueryPlan 
and Expression
URL: https://github.com/apache/spark/pull/24866#discussion_r295447130
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Expression.scala
 ##########
 @@ -113,7 +113,14 @@ abstract class Expression extends TreeNode[Expression] {
 
   def nullable: Boolean
 
-  def references: AttributeSet = 
AttributeSet.fromAttributeSets(children.map(_.references))
+  /**
+   * Workaround scala compiler so that we can call super on lazy vals
+   */
+  @transient
+  private lazy val _references: AttributeSet =
 
 Review comment:
   Sorry to be late to the party, but can we please change to lazy references + 
a compute method? It seems a bit dirty that we are overriding references 
everywhere and the we are adding lazy vals all over the place.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to