Created
November 3, 2020 14:53
-
-
Save razvan/89fe6ac152558519987f5520cf69c6c2 to your computer and use it in GitHub Desktop.
spark-sql-streaming-jdbc 2.11 2.4.0 cannot handle Date and Timestamp objects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JdbcStreamWriteSuite: | |
- Basic Write *** FAILED *** | |
org.apache.spark.sql.streaming.StreamingQueryException: Query [id = 64724d7c-f563-40bf-b482-361d71ff2159, runId = 8cac0bc9-a2e5-4956-b9c8-4376ccde7f7f] terminated with exception: Writing job aborted. | |
at org.apache.spark.sql.execution.streaming.StreamExecution.org$apache$spark$sql$execution$streaming$StreamExecution$$runStream(StreamExecution.scala:295) | |
at org.apache.spark.sql.execution.streaming.StreamExecution$$anon$1.run(StreamExecution.scala:189) | |
... | |
Cause: org.apache.spark.SparkException: Writing job aborted. | |
at org.apache.spark.sql.execution.datasources.v2.WriteToDataSourceV2Exec.doExecute(WriteToDataSourceV2Exec.scala:92) | |
at org.apache.spark.sql.execution.SparkPlan$$anonfun$execute$1.apply(SparkPlan.scala:131) | |
at org.apache.spark.sql.execution.SparkPlan$$anonfun$execute$1.apply(SparkPlan.scala:127) | |
at org.apache.spark.sql.execution.SparkPlan$$anonfun$executeQuery$1.apply(SparkPlan.scala:155) | |
at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151) | |
at org.apache.spark.sql.execution.SparkPlan.executeQuery(SparkPlan.scala:152) | |
at org.apache.spark.sql.execution.SparkPlan.execute(SparkPlan.scala:127) | |
at org.apache.spark.sql.execution.SparkPlan.getByteArrayRdd(SparkPlan.scala:247) | |
at org.apache.spark.sql.execution.SparkPlan.executeCollect(SparkPlan.scala:296) | |
at org.apache.spark.sql.Dataset.org$apache$spark$sql$Dataset$$collectFromPlan(Dataset.scala:3383) | |
... | |
Cause: org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 0.0 failed 1 times, most recent failure: Lost task 0.0 in stage 0.0 (TID 0, localhost, executor driver): java.lang.ClassCastException: java.lang.Integer cannot be cast to java.sql.Date | |
at org.apache.bahir.sql.streaming.jdbc.JdbcUtil$$anonfun$makeSetter$11.apply(JdbcUtil.scala:98) | |
at org.apache.bahir.sql.streaming.jdbc.JdbcUtil$$anonfun$makeSetter$11.apply(JdbcUtil.scala:97) | |
at org.apache.bahir.sql.streaming.jdbc.JdbcStreamDataWriter.doWriteAndResetBuffer(JdbcStreamWriter.scala:175) | |
at org.apache.bahir.sql.streaming.jdbc.JdbcStreamDataWriter.doWriteAndClose(JdbcStreamWriter.scala:206) | |
at org.apache.bahir.sql.streaming.jdbc.JdbcStreamDataWriter.commit(JdbcStreamWriter.scala:217) | |
at org.apache.spark.sql.execution.datasources.v2.DataWritingSparkTask$$anonfun$run$3.apply(WriteToDataSourceV2Exec.scala:127) | |
at org.apache.spark.sql.execution.datasources.v2.DataWritingSparkTask$$anonfun$run$3.apply(WriteToDataSourceV2Exec.scala:116) | |
at org.apache.spark.util.Utils$.tryWithSafeFinallyAndFailureCallbacks(Utils.scala:1442) | |
at org.apache.spark.sql.execution.datasources.v2.DataWritingSparkTask$.run(WriteToDataSourceV2Exec.scala:146) | |
at org.apache.spark.sql.execution.datasources.v2.WriteToDataSourceV2Exec$$anonfun$doExecute$2.apply(WriteToDataSourceV2Exec.scala:67) | |
at org.apache.spark.sql.execution.datasources.v2.WriteToDataSourceV2Exec$$anonfun$doExecute$2.apply(WriteToDataSourceV2Exec.scala:66) | |
at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:90) | |
at org.apache.spark.scheduler.Task.run(Task.scala:121) | |
at org.apache.spark.executor.Executor$TaskRunner$$anonfun$11.apply(Executor.scala:407) | |
at org.apache.spark.util.Utils$.tryWithSafeFinally(Utils.scala:1408) | |
at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:413) | |
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) | |
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) | |
at java.lang.Thread.run(Thread.java:748) | |
Driver stacktrace: | |
at org.apache.spark.scheduler.DAGScheduler.org$apache$spark$scheduler$DAGScheduler$$failJobAndIndependentStages(DAGScheduler.scala:1890) | |
at org.apache.spark.scheduler.DAGScheduler$$anonfun$abortStage$1.apply(DAGScheduler.scala:1878) | |
at org.apache.spark.scheduler.DAGScheduler$$anonfun$abortStage$1.apply(DAGScheduler.scala:1877) | |
at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59) | |
at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48) | |
at org.apache.spark.scheduler.DAGScheduler.abortStage(DAGScheduler.scala:1877) | |
at org.apache.spark.scheduler.DAGScheduler$$anonfun$handleTaskSetFailed$1.apply(DAGScheduler.scala:929) | |
at org.apache.spark.scheduler.DAGScheduler$$anonfun$handleTaskSetFailed$1.apply(DAGScheduler.scala:929) | |
at scala.Option.foreach(Option.scala:257) | |
at org.apache.spark.scheduler.DAGScheduler.handleTaskSetFailed(DAGScheduler.scala:929) | |
... | |
Cause: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.sql.Date | |
at org.apache.bahir.sql.streaming.jdbc.JdbcUtil$$anonfun$makeSetter$11.apply(JdbcUtil.scala:98) | |
at org.apache.bahir.sql.streaming.jdbc.JdbcUtil$$anonfun$makeSetter$11.apply(JdbcUtil.scala:97) | |
at org.apache.bahir.sql.streaming.jdbc.JdbcStreamDataWriter.doWriteAndResetBuffer(JdbcStreamWriter.scala:175) | |
at org.apache.bahir.sql.streaming.jdbc.JdbcStreamDataWriter.doWriteAndClose(JdbcStreamWriter.scala:206) | |
at org.apache.bahir.sql.streaming.jdbc.JdbcStreamDataWriter.commit(JdbcStreamWriter.scala:217) | |
at org.apache.spark.sql.execution.datasources.v2.DataWritingSparkTask$$anonfun$run$3.apply(WriteToDataSourceV2Exec.scala:127) | |
at org.apache.spark.sql.execution.datasources.v2.DataWritingSparkTask$$anonfun$run$3.apply(WriteToDataSourceV2Exec.scala:116) | |
at org.apache.spark.util.Utils$.tryWithSafeFinallyAndFailureCallbacks(Utils.scala:1442) | |
at org.apache.spark.sql.execution.datasources.v2.DataWritingSparkTask$.run(WriteToDataSourceV2Exec.scala:146) | |
at org.apache.spark.sql.execution.datasources.v2.WriteToDataSourceV2Exec$$anonfun$doExecute$2.apply(WriteToDataSourceV2Exec.scala:67) | |
... | |
*** RUN ABORTED *** | |
org.h2.jdbc.JdbcSQLException: Table "STREAM_TEST_TABLE" already exists; SQL statement: | |
CREATE TABLE stream_test_table( | |
name VARCHAR(32), | |
value LONG, | |
created DATE, | |
PRIMARY KEY (name) | |
) [42101-195] | |
at org.h2.message.DbException.getJdbcSQLException(DbException.java:345) | |
at org.h2.message.DbException.get(DbException.java:179) | |
at org.h2.message.DbException.get(DbException.java:155) | |
at org.h2.command.ddl.CreateTable.update(CreateTable.java:117) | |
at org.h2.command.CommandContainer.update(CommandContainer.java:101) | |
at org.h2.command.Command.executeUpdate(Command.java:260) | |
at org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:164) | |
at org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:150) | |
at org.apache.spark.sql.jdbc.JdbcStreamWriteSuite$$anonfun$1.apply$mcI$sp(JdbcStreamWriterSuite.scala:55) | |
at org.apache.spark.sql.jdbc.JdbcStreamWriteSuite$$anonfun$1.apply(JdbcStreamWriterSuite.scala:52) | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment