BenJFan opened a new issue #1503: URL: https://github.com/apache/incubator-seatunnel/issues/1503
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/incubator-seatunnel/issues?q=is%3Aissue+label%3A%22bug%22) and found no similar issues. ### What happened When use sql select const datetime, it can't convert to clickhouse DateTime type. Clickhouse DDL: ``` sql create table test_batch_cluster_all ( date04 DateTime64(3), cust_id String, cust_name String, cust_idcard String, age Int32, sex String ) engine = Distributed('cluster1', 'default', 'test_batch_cluster', age); ``` ### SeaTunnel Version dev ### SeaTunnel Config ```conf env { # You can set spark configuration here # see available properties defined by spark: https://spark.apache.org/docs/latest/configuration.html#available-properties spark.app.name = "SeaTunnel" spark.executor.instances = 2 spark.executor.cores = 1 spark.executor.memory = "1g" spark.master = local } source { # This is a example input plugin **only for test and demonstrate the feature input plugin** Fake { result_table_name = "my_dataset" } } transform { sql { sql = "select '2022-03-13 12:22:43.000' as date04, 'cust_11' as cust_id, 'cust_nn' as cust_name, 'cust_idcard' as cust_idcard, 11 as age, '男' as sex from my_dataset" } } sink { # choose stdout output plugin to output data to console Clickhouse { host = "localhost:8123" database = "default" table = "test_batch_cluster_all" fields = ["date04", "cust_id", "cust_name", "cust_idcard", "age", "sex"] username = "default" password = "" } } ``` ### Running Command ```shell - ``` ### Error Exception ```log java.lang.ClassCastException: java.lang.String cannot be cast to java.sql.Timestamp at org.apache.seatunnel.spark.sink.Clickhouse.org$apache$seatunnel$spark$sink$Clickhouse$$renderBaseTypeStatement(Clickhouse.scala:222) at org.apache.seatunnel.spark.sink.Clickhouse$$anonfun$org$apache$seatunnel$spark$sink$Clickhouse$$renderStatement$1.apply$mcVI$sp(Clickhouse.scala:269) at scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:160) at org.apache.seatunnel.spark.sink.Clickhouse.org$apache$seatunnel$spark$sink$Clickhouse$$renderStatement(Clickhouse.scala:255) at org.apache.seatunnel.spark.sink.Clickhouse$$anonfun$output$1$$anonfun$apply$1.apply(Clickhouse.scala:95) at org.apache.seatunnel.spark.sink.Clickhouse$$anonfun$output$1$$anonfun$apply$1.apply(Clickhouse.scala:91) at scala.collection.Iterator$class.foreach(Iterator.scala:891) at scala.collection.AbstractIterator.foreach(Iterator.scala:1334) at org.apache.seatunnel.spark.sink.Clickhouse$$anonfun$output$1.apply(Clickhouse.scala:91) at org.apache.seatunnel.spark.sink.Clickhouse$$anonfun$output$1.apply(Clickhouse.scala:79) at org.apache.spark.rdd.RDD$$anonfun$foreachPartition$1$$anonfun$apply$28.apply(RDD.scala:935) at org.apache.spark.rdd.RDD$$anonfun$foreachPartition$1$$anonfun$apply$28.apply(RDD.scala:935) at org.apache.spark.SparkContext$$anonfun$runJob$5.apply(SparkContext.scala:2101) at org.apache.spark.SparkContext$$anonfun$runJob$5.apply(SparkContext.scala:2101) 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$10.apply(Executor.scala:402) at org.apache.spark.util.Utils$.tryWithSafeFinally(Utils.scala:1360) at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:408) 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:750) ``` ### Flink or Spark Version _No response_ ### Java or Scala Version _No response_ ### Screenshots _No response_ ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
