我想在 spark2-shell 中阅读 Impala 的 Kudu,在很多方面都失败了:(
输入 spark2-shell:
spark2-shell --jars commons-codec-1.3.jar,hive_metastore.jar,httpclient-4.1.3.jar,ImpalaJDBC41.jar,libthrift-0.9.0.jar,ql.jar,slf4j-log4j12-1.5.11.jar,zookeeper-3.4.6.jar,commons-logging-1.1.1.jar,hive_service.jar,httpcore-4.1.3.jar,libfb303-0.9.0.jar,log4j-1.2.14.jar,slf4j-api-1.5.11.jar,TCLIServiceClient.jar
我的代码:
spark.read.format("jdbc") .option("driver","com.cloudera.impala.jdbc41.Driver")
.option("url","jdbc:impala:Domainname")
//.option("databaseName","default") also use impala::default
.option("dbtable", "impala::default.tablename")
.load()
顺便说一句,我得到了“impala::default.tablename” desc formatted tablename
。
输出:
java.lang.NullPointerException
at org.apache.spark.sql.execution.datasources.jdbc.JDBCRDD$.resolveTable(JDBCRDD.scala:72)
at org.apache.spark.sql.execution.datasources.jdbc.JDBCRelation.<init>(JDBCRelation.scala:113)
at org.apache.spark.sql.execution.datasources.jdbc.JdbcRelationProvider.createRelation(JdbcRelationProvider.scala:45)
at org.apache.spark.sql.execution.datasources.DataSource.resolveRelation(DataSource.scala:330)
at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:152)
at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:125)
... 48 elided