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

    https://github.com/apache/spark/pull/9553#discussion_r48095548
  
    --- Diff: 
repl/scala-2.10/src/main/scala/org/apache/spark/repl/SparkILoop.scala ---
    @@ -1026,17 +1027,30 @@ class SparkILoop(
     
       @DeveloperApi
       def createSQLContext(): SQLContext = {
    -    val name = "org.apache.spark.sql.hive.HiveContext"
    +    useHiveContext = 
sparkContext.getConf.getBoolean("spark.sql.useHiveContext", true)
    +    val name = {
    +      if (useHiveContext) "org.apache.spark.sql.hive.HiveContext"
    +      else "org.apache.spark.sql.SQLContext"
    +    }
    +
         val loader = Utils.getContextOrSparkClassLoader
         try {
           sqlContext = 
loader.loadClass(name).getConstructor(classOf[SparkContext])
             .newInstance(sparkContext).asInstanceOf[SQLContext]
    -      logInfo("Created sql context (with Hive support)..")
    +      if (useHiveContext) {
    +        logInfo("Created sql context (with Hive support). To use 
sqlContext (without Hive), " +
    +          "set spark.sql.useHiveContext to false before launching 
spark-shell.")
    +      }
    +      else {
    +        logInfo("Created sql context.")
    +      }
         }
         catch {
    -      case _: java.lang.ClassNotFoundException | _: 
java.lang.NoClassDefFoundError =>
    +      case _: java.lang.ClassNotFoundException | _: 
java.lang.NoClassDefFoundError
    +        if useHiveContext =>
             sqlContext = new SQLContext(sparkContext)
    -        logInfo("Created sql context..")
    +        logInfo("Created sql context without Hive support, " +
    +          "build Spark with -Phive to enable Hive support.")
    --- End diff --
    
    It is possible that `-Phive` is used but there was an exception. Can we 
also update the log message for this case?


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