Мой код следующий:
val optionMap = Map(
"driver" -> "net.ucanaccess.jdbc.UcanaccessDriver",
"url" -> s"jdbc:ucanaccess://$mdbPath;memory=false;showSchema=true",
"dbtable" -> tableName,
"user" -> "",
"password" -> "")
val result = Try{ spark.read.format("jdbc").options(optionMap).load }
Версии библиотеки:
val sparkVersion = "2.2.0"
"net.sf.ucanaccess" % "ucanaccess" % "4.0.4"
Я вижу ошибку:
Caused by: net.ucanaccess.jdbc.UcanaccessSQLException: UCAExc:::0.1-SNAPSHOT incompatible data type in conversion: from SQL type CHARACTER to java.lang.Double, value: codc17b
at net.ucanaccess.jdbc.UcanaccessResultSet.getDouble(UcanaccessResultSet.java:447)
at org.apache.spark.sql.execution.datasources.jdbc.JdbcUtils$$anonfun$org$apache$spark$sql$execution$datasources$jdbc$JdbcUtils$$makeGetter$4.apply(JdbcUtils.scala:386)
at org.apache.spark.sql.execution.datasources.jdbc.JdbcUtils$$anonfun$org$apache$spark$sql$execution$datasources$jdbc$JdbcUtils$$makeGetter$4.apply(JdbcUtils.scala:385)
at org.apache.spark.sql.execution.datasources.jdbc.JdbcUtils$$anon$1.getNext(JdbcUtils.scala:330)
at org.apache.spark.sql.execution.datasources.jdbc.JdbcUtils$$anon$1.getNext(JdbcUtils.scala:312)
at org.apache.spark.util.NextIterator.hasNext(NextIterator.scala:73)
at org.apache.spark.InterruptibleIterator.hasNext(InterruptibleIterator.scala:37)
at org.apache.spark.util.CompletionIterator.hasNext(CompletionIterator.scala:32)
at org.apache.spark.sql.catalyst.expressions.GeneratedClass$GeneratedIterator.processNext(Unknown Source)
at org.apache.spark.sql.execution.BufferedRowIterator.hasNext(BufferedRowIterator.java:43)
at org.apache.spark.sql.execution.WholeStageCodegenExec$$anonfun$8$$anon$1.hasNext(WholeStageCodegenExec.scala:395)
at org.apache.spark.sql.execution.datasources.FileFormatWriter$SingleDirectoryWriteTask.execute(FileFormatWriter.scala:315)
at org.apache.spark.sql.execution.datasources.FileFormatWriter$$anonfun$org$apache$spark$sql$execution$datasources$FileFormatWriter$$executeTask$3.apply(FileFormatWriter.scala:258)
at org.apache.spark.sql.execution.datasources.FileFormatWriter$$anonfun$org$apache$spark$sql$execution$datasources$FileFormatWriter$$executeTask$3.apply(FileFormatWriter.scala:256)
at org.apache.spark.util.Utils$.tryWithSafeFinallyAndFailureCallbacks(Utils.scala:1375)
at org.apache.spark.sql.execution.datasources.FileFormatWriter$.org$apache$spark$sql$execution$datasources$FileFormatWriter$$executeTask(FileFormatWriter.scala:261)
... 8 more
Caused by: java.sql.SQLSyntaxErrorException: incompatible data type in conversion: from SQL type CHARACTER to java.lang.Double, value: codc17b
at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source)
at org.hsqldb.jdbc.JDBCUtil.throwError(Unknown Source)
at org.hsqldb.jdbc.JDBCResultSet.getColumnInType(Unknown Source)
at org.hsqldb.jdbc.JDBCResultSet.getDouble(Unknown Source)
at net.ucanaccess.jdbc.UcanaccessResultSet.getDouble(UcanaccessResultSet.java:445)
... 23 more
Caused by: org.hsqldb.HsqlException: incompatible data type in conversion: from SQL type CHARACTER to java.lang.Double, value: codc17b
at org.hsqldb.error.Error.error(Unknown Source)
at org.hsqldb.error.Error.error(Unknown Source)
... 26 more
Что я могусделать, чтобы исправить это или как woraround?