bhollis-dbx commented on code in PR #58865:
URL: https://github.com/apache/spark/pull/58865#discussion_r4125622910
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/trees/TreeNode.scala:
##########
@@ -118,8 +136,19 @@ abstract class TreeNode[BaseType <: TreeNode[BaseType]]
* A BitSet of tree patterns for this TreeNode and its subtree. If this
TreeNode and its
* subtree contains a pattern `P`, the corresponding bit for `P.id` is set
in this BitSet.
*/
- private val _treePatternBits = new BestEffortLazyVal[BitSet](() =>
getDefaultTreePatternBits)
- override def treePatternBits: BitSet = _treePatternBits()
+ @volatile private var treePatternBitsCacheValue: BitSet = _
+ override def treePatternBits: BitSet = {
+ var value = treePatternBitsCacheValue
+ if (value eq null) {
+ val computed = getDefaultTreePatternBits
Review Comment:
Documented that cache computations must not return null because null is the
uninitialized sentinel.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]