2017-01-18 77 views
1

是spark 2.0的插件更新嗎? 我不能使用該插件Phoenix Spark Plugin

val df = spark.read 
     .format("org.apache.phoenix.spark") 
     .option("table", "web_stat") 
     .option("zkUrl", "localhost:2181") 
     .option("driver","org.apache.phoenix.jdbc.PhoenixDriver") 
     .load() 

錯誤:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/spark/sql/DataFrame 

只是JDBC連接鳳凰是OK!

時,我只是用火花JDBC連接器,它自帶

val df = spark.read 
     .format("jdbc") 
     .option("driver", "org.apache.phoenix.jdbc.PhoenixDriver") 
     .option("url", " jdbc:phoenix:localhost:2181") 
     .option("dbtable", "web_stat") 
     .load() 

ERROR

Exception in thread "main" java.lang.NullPointerException at org.apache.spark.sql.execution.datasources.jdbc.JDBCRDD$.resolveTable(JDBCRDD.scala:167) at org.apache.spark.sql.execution.datasources.jdbc.JDBCRelation.(JDBCRelation.scala:117) at org.apache.spark.sql.execution.datasources.jdbc.JdbcRelationProvider.createRelation(JdbcRelationProvider.scala:53) at org.apache.spark.sql.execution.datasources.DataSource.resolveRelation(DataSource.scala:345) at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:149) at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:122) at org.apache.spark.sql.phoenix.SparkPhoenixExample$.main(SparkPhoenixExample.scala:65)

回答

相關問題