我想读《 Impala 在斯巴克2炮弹中的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
1条答案
按热度按时间hvvq6cgz1#
最好直接用spark连接到kudu,然后通过impala连接,因为这里有文档https://blog.cloudera.com/blog/2017/02/up-and-running-with-apache-spark-on-apache-kudu/
impala为spark sql提供了极具竞争力的性能