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

    https://github.com/apache/spark/pull/3672#discussion_r21720621
  
    --- Diff: 
sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/HiveThriftServer2.scala
 ---
    @@ -85,10 +86,22 @@ private[hive] class HiveThriftServer2(hiveContext: 
HiveContext)
         setSuperField(this, "cliService", sparkSqlCliService)
         addService(sparkSqlCliService)
     
    -    val thriftCliService = new ThriftBinaryCLIService(sparkSqlCliService)
    -    setSuperField(this, "thriftCLIService", thriftCliService)
    -    addService(thriftCliService)
    +    if (isHTTPTransportMode(hiveConf)){
    +      val thriftCliService = new ThriftHttpCLIService(sparkSqlCliService)
    +      setSuperField(this, "thriftCLIService", thriftCliService)
    +      addService(thriftCliService)
    +    } else {
    +      val thriftCliService = new ThriftBinaryCLIService(sparkSqlCliService)
    +      setSuperField(this, "thriftCLIService", thriftCliService)
    +      addService(thriftCliService)
    +    }
     
         initCompositeService(hiveConf)
       }
    +
    +  private def isHTTPTransportMode(hiveConf: HiveConf): Boolean = {
    +    val transportMode: String = 
hiveConf.getVar(ConfVars.HIVE_SERVER2_TRANSPORT_MODE)
    +    return transportMode.equalsIgnoreCase("http")
    --- End diff --
    
    Yea, usually we don't use `return` unless absolutely necessary. Everything 
is an expression in Scala, and the last expression of the function body is the 
return value.
    
    BTW, here is a brief [Spark code style guide] [1].
    
    [1]: 
https://cwiki.apache.org/confluence/display/SPARK/Spark+Code+Style+Guide


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to