You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by ki...@apache.org on 2022/05/09 02:40:03 UTC

[incubator-seatunnel] branch dev updated: [fix bug] the Decimal(P, S) cast to String ClassCastException (#1810)

This is an automated email from the ASF dual-hosted git repository.

kirs pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-seatunnel.git


The following commit(s) were added to refs/heads/dev by this push:
     new a23fa528 [fix bug] the Decimal(P, S)  cast to String  ClassCastException (#1810)
a23fa528 is described below

commit a23fa528bd34b2d3b1e3622e3ae602fb344aa21b
Author: v-wx-v <39...@users.noreply.github.com>
AuthorDate: Mon May 9 10:39:58 2022 +0800

    [fix bug] the Decimal(P, S)  cast to String  ClassCastException (#1810)
    
    * Add release-node of 2.1.1
    
    * Revert "Add release-node of 2.1.1"
    
    This reverts commit 34090bfc
    
    * [fix bug] the Decimal(P, S)  cast to String  ClassCastException
    
    Co-authored-by: ruanwenjun <we...@apache.org>
    Co-authored-by: wangxx <wa...@kcwl.com>
---
 .../scala/org/apache/seatunnel/spark/clickhouse/sink/Clickhouse.scala   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/seatunnel-connectors/seatunnel-connectors-spark/seatunnel-connector-spark-clickhouse/src/main/scala/org/apache/seatunnel/spark/clickhouse/sink/Clickhouse.scala b/seatunnel-connectors/seatunnel-connectors-spark/seatunnel-connector-spark-clickhouse/src/main/scala/org/apache/seatunnel/spark/clickhouse/sink/Clickhouse.scala
index 8d5c2752..99c0ae51 100644
--- a/seatunnel-connectors/seatunnel-connectors-spark/seatunnel-connector-spark-clickhouse/src/main/scala/org/apache/seatunnel/spark/clickhouse/sink/Clickhouse.scala
+++ b/seatunnel-connectors/seatunnel-connectors-spark/seatunnel-connector-spark-clickhouse/src/main/scala/org/apache/seatunnel/spark/clickhouse/sink/Clickhouse.scala
@@ -270,7 +270,7 @@ class Clickhouse extends SparkBatchSink {
       case Clickhouse.arrayPattern(_) =>
         val value = item.getAs[Seq[Any]](fieldIndex).toArray
         statement.setArray(index + 1, new ClickHouseArray(ClickHouseDataType.String, value))
-      case "Decimal" => statement.setBigDecimal(index + 1, item.getAs[BigDecimal](fieldIndex))
+      case Clickhouse.decimalPattern(_) => statement.setBigDecimal(index + 1, item.getAs[BigDecimal](fieldIndex))
       case _ => statement.setString(index + 1, item.getAs[String](fieldIndex))
     }
   }