Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-37448

Avoid CurrentOrigin.withOrigin calls in tree transformation methods when partial function isn't defined

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: In Progress
    • Major
    • Resolution: Unresolved
    • 3.2.0
    • None
    • Optimizer
    • None

    Description

      `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.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            joshrosen Josh Rosen
            joshrosen Josh Rosen

            Dates

              Created:
              Updated:

              Issue deployment