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

Scope Session.active in QueryExecution

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.0
    • Fix Version/s: 3.0.0
    • Component/s: SQL
    • Labels:
      None

      Description

      SparkSession.active is a thread local variable that points to the current thread's spark session. It is important to note that the SQLConf.get method depends on SparkSession.active. In the current implementation it is possible that SparkSession.active points to a different session which causes various problems. Most of these problems arise because part of the query processing is done using the configurations of a different session. For example, when creating a data frame using a new session, i.e., session.sql("..."), part of the data frame is constructed using the currently active spark session, which can be a different session from the one used later for processing the query.

      This PR scopes SparkSession.active to prevent the above-mentioned problems. A new method, withActive is introduced on SparkSession that restores the previous spark session after the block of code is executed.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                afroozeh Ali Afroozeh
                Reporter:
                afroozeh Ali Afroozeh
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: