baidu_24473805
天下无双418
2017-06-06 08:21

spark通过jdbc读取hive的表报错,我是在zeppelin里运行的

10
  • hive
  • spark
  • jdbc

代码:

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

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答