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

diwu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris-flink-connector.git


The following commit(s) were added to refs/heads/master by this push:
     new 57ea05d  [Fix]fix type mapping with mysql and pg  (#183)
57ea05d is described below

commit 57ea05d9a8d2d25d123c983727d3c6d258285d06
Author: wudi <676366...@qq.com>
AuthorDate: Thu Aug 24 15:56:50 2023 +0800

    [Fix]fix type mapping with mysql and pg  (#183)
---
 .../main/java/org/apache/doris/flink/tools/cdc/mysql/MysqlType.java | 2 --
 .../org/apache/doris/flink/tools/cdc/postgres/PostgresType.java     | 6 ++++++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git 
a/flink-doris-connector/src/main/java/org/apache/doris/flink/tools/cdc/mysql/MysqlType.java
 
b/flink-doris-connector/src/main/java/org/apache/doris/flink/tools/cdc/mysql/MysqlType.java
index 92325ac..143ea52 100644
--- 
a/flink-doris-connector/src/main/java/org/apache/doris/flink/tools/cdc/mysql/MysqlType.java
+++ 
b/flink-doris-connector/src/main/java/org/apache/doris/flink/tools/cdc/mysql/MysqlType.java
@@ -140,8 +140,6 @@ public class MysqlType {
             case TIMESTAMP:
                 return String.format("%s(%s)", DorisType.DATETIME_V2, 
Math.min(length == null ? 0 : length, 6));
             case CHAR:
-                Preconditions.checkNotNull(length);
-                return String.format("%s(%s)", DorisType.CHAR, length);
             case VARCHAR:
                 Preconditions.checkNotNull(length);
                 return length * 3 > 65533 ? DorisType.STRING : 
String.format("%s(%s)", DorisType.VARCHAR, length * 3);
diff --git 
a/flink-doris-connector/src/main/java/org/apache/doris/flink/tools/cdc/postgres/PostgresType.java
 
b/flink-doris-connector/src/main/java/org/apache/doris/flink/tools/cdc/postgres/PostgresType.java
index 8886c09..5c2feff 100644
--- 
a/flink-doris-connector/src/main/java/org/apache/doris/flink/tools/cdc/postgres/PostgresType.java
+++ 
b/flink-doris-connector/src/main/java/org/apache/doris/flink/tools/cdc/postgres/PostgresType.java
@@ -67,6 +67,9 @@ public class PostgresType {
 
     public static String toDorisType(String postgresType, Integer precision, 
Integer scale) {
         postgresType = postgresType.toLowerCase();
+        if(postgresType.startsWith("_")){
+          return DorisType.STRING;
+        }
         switch (postgresType){
             case INT2:
             case SMALLSERIAL:
@@ -121,6 +124,8 @@ public class PostgresType {
             case JSON:
             case JSONB:
                 return DorisType.JSONB;
+            /* Compatible with doris1.2 array type can only be used in dup 
table,
+               and then converted to array in the next version
             case _BOOL:
                 return String.format("%s<%s>", DorisType.ARRAY, 
DorisType.BOOLEAN);
             case _INT2:
@@ -139,6 +144,7 @@ public class PostgresType {
                 return String.format("%s<%s>", DorisType.ARRAY, 
DorisType.DATE_V2);
             case _TIMESTAMP:
                 return String.format("%s<%s>", DorisType.ARRAY, 
DorisType.DATETIME_V2);
+            **/
             default:
                 throw new UnsupportedOperationException("Unsupported Postgres 
Type: " + postgresType);
         }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to