cloud-fan commented on issue #26473: [SPARK-29864][SPARK-29920][SQL] Strict 
parsing of day-time strings to intervals
URL: https://github.com/apache/spark/pull/26473#issuecomment-558727199
 
 
   I've figured out the problem: The Spark thrift server creates many 
SparkSessions to serve requests, and the thrift server serves requests using a 
single thread. One thread can only have one active SparkSession, so 
`SQLCong.get` can't get the proper conf from the session that runs the query.
   
   For this particular problem, a simple fix is
   ```
   def sql(sqlText: String): DataFrame = {
        val tracker = new QueryPlanningTracker
   +    SparkSession.setActiveSession(this)
        val plan = tracker.measurePhase(QueryPlanningTracker.PARSING) {
          sessionState.sqlParser.parsePlan(sqlText)
        }
   ```
   
   But we should really think about how to set active session correctly.

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