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:07:14 UTC
[incubator-seatunnel] branch dev updated: [bug][flink-connector-jdbc]supplement mysql jdbc all type information (#1816)
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 fcadfebc [bug][flink-connector-jdbc]supplement mysql jdbc all type information (#1816)
fcadfebc is described below
commit fcadfebcc51d44aff8dda93fb6e7e6bcb1d017e8
Author: 沫 <32...@njau.edu.cn>
AuthorDate: Mon May 9 10:07:10 2022 +0800
[bug][flink-connector-jdbc]supplement mysql jdbc all type information (#1816)
* add mysql support typeinformation bit
* Supplement mysql jdbc all types
Co-authored-by: zhoutao.tobeone <zh...@bytedance.com>
---
.../flink/jdbc/input/MysqlTypeInformationMap.java | 38 ++++++++++++++++------
1 file changed, 28 insertions(+), 10 deletions(-)
diff --git a/seatunnel-connectors/seatunnel-connectors-flink/seatunnel-connector-flink-jdbc/src/main/java/org/apache/seatunnel/flink/jdbc/input/MysqlTypeInformationMap.java b/seatunnel-connectors/seatunnel-connectors-flink/seatunnel-connector-flink-jdbc/src/main/java/org/apache/seatunnel/flink/jdbc/input/MysqlTypeInformationMap.java
index a3dcc3b2..cf6e916c 100644
--- a/seatunnel-connectors/seatunnel-connectors-flink/seatunnel-connector-flink-jdbc/src/main/java/org/apache/seatunnel/flink/jdbc/input/MysqlTypeInformationMap.java
+++ b/seatunnel-connectors/seatunnel-connectors-flink/seatunnel-connector-flink-jdbc/src/main/java/org/apache/seatunnel/flink/jdbc/input/MysqlTypeInformationMap.java
@@ -39,33 +39,51 @@ public class MysqlTypeInformationMap implements TypeInformationMap {
private static final Map<String, TypeInformation<?>> INFORMATION_MAP = new HashMap<>();
static {
-
- INFORMATION_MAP.put("VARCHAR", STRING_TYPE_INFO);
- INFORMATION_MAP.put("BOOLEAN", BOOLEAN_TYPE_INFO);
+ //Numeric Data Types
+ INFORMATION_MAP.put("BIT", BOOLEAN_TYPE_INFO);
INFORMATION_MAP.put("TINYINT", INT_TYPE_INFO);
INFORMATION_MAP.put("TINYINT UNSIGNED", INT_TYPE_INFO);
INFORMATION_MAP.put("SMALLINT", SHORT_TYPE_INFO);
INFORMATION_MAP.put("SMALLINT UNSIGNED", INT_TYPE_INFO);
- INFORMATION_MAP.put("INTEGER", INT_TYPE_INFO);
- INFORMATION_MAP.put("INTEGER UNSIGNED", INT_TYPE_INFO);
INFORMATION_MAP.put("MEDIUMINT", INT_TYPE_INFO);
INFORMATION_MAP.put("MEDIUMINT UNSIGNED", INT_TYPE_INFO);
- INFORMATION_MAP.put("INT", INT_TYPE_INFO);
- INFORMATION_MAP.put("INT UNSIGNED", LONG_TYPE_INFO);
+ INFORMATION_MAP.put("INTEGER", INT_TYPE_INFO);
+ INFORMATION_MAP.put("INTEGER UNSIGNED", INT_TYPE_INFO);
INFORMATION_MAP.put("BIGINT", LONG_TYPE_INFO);
INFORMATION_MAP.put("BIGINT UNSIGNED", STRING_TYPE_INFO);
INFORMATION_MAP.put("FLOAT", FLOAT_TYPE_INFO);
INFORMATION_MAP.put("DOUBLE", DOUBLE_TYPE_INFO);
+ INFORMATION_MAP.put("DECIMAL", BIG_DEC_TYPE_INFO);
+ INFORMATION_MAP.put("INT", INT_TYPE_INFO);
+ INFORMATION_MAP.put("INT UNSIGNED", LONG_TYPE_INFO);
+ INFORMATION_MAP.put("BOOLEAN", BOOLEAN_TYPE_INFO);
+
+ //String Data Types
INFORMATION_MAP.put("CHAR", STRING_TYPE_INFO);
+ INFORMATION_MAP.put("VARCHAR", STRING_TYPE_INFO);
+ INFORMATION_MAP.put("BINARY", BYTE_PRIMITIVE_ARRAY_TYPE_INFO);
+ INFORMATION_MAP.put("VARBINARY", BYTE_PRIMITIVE_ARRAY_TYPE_INFO);
+ INFORMATION_MAP.put("BLOB", BYTE_PRIMITIVE_ARRAY_TYPE_INFO);
+ INFORMATION_MAP.put("TINYBLOB", BYTE_PRIMITIVE_ARRAY_TYPE_INFO);
+ INFORMATION_MAP.put("MEDIUMBLOB", BYTE_PRIMITIVE_ARRAY_TYPE_INFO);
+ INFORMATION_MAP.put("LONGBLOB", BYTE_PRIMITIVE_ARRAY_TYPE_INFO);
INFORMATION_MAP.put("TEXT", STRING_TYPE_INFO);
+ INFORMATION_MAP.put("TINYTEXT", STRING_TYPE_INFO);
+ INFORMATION_MAP.put("MEDIUMTEXT", STRING_TYPE_INFO);
INFORMATION_MAP.put("LONGTEXT", STRING_TYPE_INFO);
+
+ //JSON Data Type
+ INFORMATION_MAP.put("JSON", STRING_TYPE_INFO);
+
+ //Spatial Data Types
+ INFORMATION_MAP.put("GEOMETRY", BYTE_PRIMITIVE_ARRAY_TYPE_INFO);
+
+ //Date and Time Data Types
INFORMATION_MAP.put("DATE", SqlTimeTypeInfo.DATE);
INFORMATION_MAP.put("TIME", SqlTimeTypeInfo.TIME);
INFORMATION_MAP.put("DATETIME", SqlTimeTypeInfo.TIMESTAMP);
INFORMATION_MAP.put("TIMESTAMP", SqlTimeTypeInfo.TIMESTAMP);
- INFORMATION_MAP.put("DECIMAL", BIG_DEC_TYPE_INFO);
- INFORMATION_MAP.put("BINARY", BYTE_PRIMITIVE_ARRAY_TYPE_INFO);
-
+ INFORMATION_MAP.put("YEAR", SqlTimeTypeInfo.DATE);
}
@Override