I am using spark(standalone) of CDH5.4.2
After copying hive-site.xml
to $SPARK_HOME/conf
,i can query from hive in spark-shell
,such as below:
scala> val hiveContext = new org.apache.spark.sql.hive.HiveContext(sc); hiveContext: org.apache.spark.sql.hive.HiveContext = org.apache.spark.sql.hive.HiveContext@6c6f3a15 scala> hiveContext.sql("show tables").show();
But when i open spark-sql
,it show wrong:
java.lang.ClassNotFoundException: org.apache.spark.sql.hive.thriftserver.SparkSQLCLIDriver Failed to load main class org.apache.spark.sql.hive.thriftserver.SparkSQLCLIDriver.
You need to build Spark with -Phive and -Phive-thriftserver.
What is different between spark-shell
and spark-sql
? If spark of cdh don't support hive,why can i use HiveConext
?