Github user liancheng commented on a diff in the pull request:

    https://github.com/apache/spark/pull/3946#discussion_r23149156
  
    --- Diff: 
sql/hive-thriftserver/v0.13.1/src/main/scala/org/apache/spark/sql/hive/thriftserver/Shim13.scala
 ---
    @@ -154,8 +176,18 @@ private[hive] class SparkExecuteStatementOperation(
       }
     
       def run(): Unit = {
    +    val sid = UUID.randomUUID().toString 
         logInfo(s"Running query '$statement'")
         setState(OperationState.RUNNING)
    +    val group = 
hiveContext.sparkContext.getLocalProperty(SparkContext.SPARK_JOB_GROUP_ID) 
match {
    +      case groupId: String =>
    +        hiveContext.sparkContext.setJobDescription(statement)
    +        groupId
    +      case _ => hiveContext.sparkContext
    +        .setJobGroup(parentSession.getSessionHandle.getSessionId.toString, 
statement)
    +        sid
    +    }
    --- End diff --
    
    Could be simplified to this:
    
    ```scala
    val groupId = 
Option(hiveContext.sparkContext.getLocalProperty(SparkContext.SPARK_JOB_GROUP_ID)).getOrElse(sid)
    hiveContext.sparkContext.setJobGroup(groupId, statement)
    ```
    
    We shouldn't use session ID as group ID, otherwise all statements issued by 
the current session will be cancelled once the job group is cancelled.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to