You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Josh Rosen (Jira)" <ji...@apache.org> on 2021/11/23 08:43:00 UTC

[jira] [Created] (SPARK-37448) Avoid CurrentOrigin.withOrigin calls in tree transformation methods when partial function isn't defined

Josh Rosen created SPARK-37448:
----------------------------------

             Summary: Avoid CurrentOrigin.withOrigin calls in tree transformation methods when partial function isn't defined
                 Key: SPARK-37448
                 URL: https://issues.apache.org/jira/browse/SPARK-37448
             Project: Spark
          Issue Type: Improvement
          Components: Optimizer
    Affects Versions: 3.2.0
            Reporter: Josh Rosen
            Assignee: Josh Rosen


`CurrentOrigin.withOrigin \{ block }` performs a ThreadLocal.get() call to retrieve the current value of the `origin` thread local so it can be restored after `block` exits.

TreeNode has transform methods which apply PartialFunctions to every node in the tree. By checking `rule.isDefinedAt` before applying a rule we can skip the `CurrentOrigin.withOrigin` call in cases where we know the partial function isn't defined. This avoids the performance overhead associated with thread-local reads and sets.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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