Support Questions
Find answers, ask questions, and share your expertise

phoenix spark plugin read data problem?

Explorer

 

 

 

 

import org.apache.hadoop.conf.Configuration import org.apache.spark.SparkContext import org.apache.spark.sql.SQLContext import org.apache.phoenix.spark._ val configuration = new Configuration() configuration.set("hbase.zookeeper.quorum", "bigdser5,bigdser3,bigdser2") configuration.set("hbase.master.kerberos.principal", "****") configuration.set("hbase.regionserver.kerberos.principal", "****") configuration.set("phoenix.queryserver.kerberos.principal", "****") configuration.set("hbase.security.authentication", "kerberos") configuration.set("hadoop.security.authentication", "kerberos") configuration.set("zookeeper.znode.parent", "/hbase") configuration.set("hbase.myclient.keytab", "/hadoop/app/jztwk.keytab") configuration.set("hbase.myclient.principal", "****") configuration.set("phoenix.schema.isNamespaceMappingEnabled","true") configuration.set("phoenix.schema.mapSystemTablesToNamespace", "true") 
val df = spark.sqlContext.phoenixTableAsDataFrame("PHTEST", Array("ID", "CITY"), conf = configuration)

 

 

 

 

 

when I run this code in spark-shell

I get a error

 

Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
java.lang.NullPointerException
at org.apache.phoenix.jdbc.PhoenixEmbeddedDriver$ConnectionInfo.isSameName(PhoenixEmbeddedDriver.java:438)
at org.apache.phoenix.jdbc.PhoenixEmbeddedDriver$ConnectionInfo.isSameName(PhoenixEmbeddedDriver.java:409)
at org.apache.phoenix.jdbc.PhoenixEmbeddedDriver$ConnectionInfo.normalize(PhoenixEmbeddedDriver.java:377)
at org.apache.phoenix.jdbc.PhoenixDriver.getConnectionQueryServices(PhoenixDriver.java:238)
at org.apache.phoenix.jdbc.PhoenixEmbeddedDriver.createConnection(PhoenixEmbeddedDriver.java:150)
at org.apache.phoenix.jdbc.PhoenixDriver.connect(PhoenixDriver.java:221)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:208)
at org.apache.phoenix.mapreduce.util.ConnectionUtil.getConnection(ConnectionUtil.java:113)
at org.apache.phoenix.mapreduce.util.ConnectionUtil.getInputConnection(ConnectionUtil.java:58)
at org.apache.phoenix.mapreduce.util.PhoenixConfigurationUtil.getSelectColumnMetadataList(PhoenixConfigurationUtil.java:355)
at org.apache.phoenix.spark.PhoenixRDD.toDataFrame(PhoenixRDD.scala:118)
at org.apache.phoenix.spark.SparkSqlContextFunctions.phoenixTableAsDataFrame(SparkSqlContextFunctions.scala:39)
... 51 elided

0 REPLIES 0