代码:
import org.apache.spark.sql.hive.HiveContext
val pro = new java.util.Properties()
pro.setProperty("user", "****")
pro.setProperty("password", "*****")
val driverName = "org.apache.hadoop.hive.jdbc.HiveDriver";
Class.forName(driverName);
val hiveContext = new HiveContext(sc)
val hivetable = hiveContext.read.jdbc("jdbc:hive://*****/default", "*****", pro);
错误:
import org.apache.spark.sql.hive.HiveContext
pro: java.util.Properties = {}
res15: Object = null
res16: Object = null
driverName: String = org.apache.hadoop.hive.jdbc.HiveDriver
res17: Class[_] = class org.apache.hadoop.hive.jdbc.HiveDriver
warning: there was one deprecation warning; re-run with -deprecation for details
hiveContext: org.apache.spark.sql.hive.HiveContext = org.apache.spark.sql.hive.HiveContext@14f9cc13
java.sql.SQLException: Method not supported
at org.apache.hadoop.hive.jdbc.HiveResultSetMetaData.isSigned(Unknown Source)
at org.apache.spark.sql.execution.datasources.jdbc.JdbcUtils$.getSchema(JdbcUtils.scala:232)
at org.apache.spark.sql.execution.datasources.jdbc.JDBCRDD$.resolveTable(JDBCRDD.scala:64)
at org.apache.spark.sql.execution.datasources.jdbc.JDBCRelation.(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)
at org.apache.spark.sql.DataFrameReader.jdbc(DataFrameReader.scala:166)
... 46 elided