請看下面的代碼。 當我傳遞分區數值時,下面的代碼出現錯誤。在我的火花應用程序中對未完全指定的錯誤進行分區
def loadDataFromPostgress(sqlContext: SQLContext, tableName: String,
columnName: String, dbURL: String, userName: String, pwd: String,
partitions: String): DataFrame = {
println("the no of partitions are : "+partitions)
var dataDF = sqlContext.read.format("jdbc").options(
scala.collection.Map("url" -> dbURL,
"dbtable" -> tableName,
"driver" -> "org.postgresql.Driver",
"user" -> userName,
"password" -> pwd,
"partitionColumn" -> columnName,
"numPartitions" -> "1000")).load()
return dataDF
}
錯誤:
java.lang.RuntimeException: Partitioning incompletely specified
App > at scala.sys.package$.error(package.scala:27)
App > at org.apache.spark.sql.execution.datasources.jdbc.JdbcRelationProvider.createRelation(JdbcRelationProvider.scala:38)
App > at org.apache.spark.sql.execution.datasources.DataSource.resolveRelation(DataSource.scala:315)
App > at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:149)
App > at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:122)
App > at Test$.loadDataFromGreenPlum(script.scala:28)
App > at Test$.loadDataFrame(script.scala:15)
App > at Test$.main(script.scala:59)
App > at Test.main(script.scala)
App > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
App > at