目录
一、背景
二、映射
1.Hive
2.HBase
3.MongoDB
4.Oracle
5.PostgreSQL
6.SqlServer
7.Mysql
8.ODPS
9.OSS
10.OTS
11. TSDB
12.ADB PG
13.ADS
14. Cassandra
15.DRDS
16.Phoenix
17.KingbaseES
一、背景
datax内置的enumType数据类型与不同数据库间都有些差异,本文整理出相应的映射关系,在配置自定义json时可以参考做一些类型转换
二、映射
1.Hive
DataX 数据类型 | Hive表 数据类型 |
---|---|
Long | TINYINT,SMALLINT,INT,BIGINT |
Double | FLOAT,DOUBLE |
String | String,CHAR,VARCHAR,STRUCT,MAP,ARRAY,UNION,BINARY |
Boolean | BOOLEAN |
Date | Date,TIMESTAMP |
2.HBase
DataX 数据类型 | HBase 数据类型 |
---|---|
Long | int, short ,long |
Double | float, double |
String | string,binarystring |
Date | date |
Boolean | boolean |
3.MongoDB
DataX 数据类型 | MongoDB 数据类型 |
---|---|
Long | int, Long |
Double | double |
String | string, array |
Date | date |
Boolean | boolean |
Bytes | bytes |
4.Oracle
DataX 数据类型 | Oracle 数据类型 |
---|---|
Long | NUMBER,INTEGER,INT,SMALLINT |
Double | NUMERIC,DECIMAL,FLOAT,DOUBLE PRECISION,REAL |
String | LONG,CHAR,NCHAR,VARCHAR,VARCHAR2,NVARCHAR2,CLOB,NCLOB,CHARACTER,CHARACTER VARYING,CHAR VARYING,NATIONAL CHARACTER,NATIONAL CHAR,NATIONAL CHARACTER VARYING,NATIONAL CHAR VARYING,NCHAR VARYING |
Date | TIMESTAMP,DATE |
Boolean | bit, bool |
Bytes | BLOB,BFILE,RAW,LONG RAW |
5.PostgreSQL
DataX 数据类型 | PostgreSQL 数据类型 |
---|---|
Long | bigint, bigserial, integer, smallint, serial |
Double | double precision, money, numeric, real |
String | varchar, char, text, bit, inet |
Date | date, time, timestamp |
Boolean | bool |
Bytes | bytea |
6.SqlServer
DataX 数据类型 | SqlServer 数据类型 |
---|---|
Long | bigint, int, smallint, tinyint |
Double | float, decimal, real, numeric |
String | char,nchar,ntext,nvarchar,text,varchar,nvarchar(MAX),varchar(MAX) |
Date | date, datetime, time |
Boolean | bit |
Bytes | binary,varbinary,varbinary(MAX),timestamp |
7.Mysql
DataX 数据类型 | Mysql 数据类型 |
---|---|
Long | int, tinyint, smallint, mediumint, int, bigint, year |
Double | float, double, decimal |
String | varchar, char, tinytext, text, mediumtext, longtext |
Date | date, datetime, timestamp, time |
Boolean | bit, bool |
Bytes | tinyblob, mediumblob, blob, longblob, varbinary |
8.ODPS
DataX 数据类型 | ODPS 数据类型 |
---|---|
Long | BIGINT |
Double | DOUBLE |
String | STRING |
Date | DATETIME |
Boolean | Boolean |
9.OSS
DataX 数据类型 | OSS 数据类型 |
---|---|
Long | Long |
Double | Double |
String | String |
Boolean | Boolean |
Date | Date |
10.OTS
DataX 数据类型 | OTS 数据类型 |
---|---|
Long | Integer |
Double | Double |
String | String |
Boolean | Boolean |
Bytes | Binary |
11. TSDB
DataX 数据类型 | TSDB 数据类型 |
---|---|
String | TSDB 数据点序列化字符串,包括 timestamp、metric、tags 和 value |
12.ADB PG
DataX 数据类型 | ADB PG 数据类型 |
---|---|
Long | bigint, bigserial, integer, smallint, serial |
Double | double precision, float, numeric, real |
String | varchar, char, text |
Date | date, time, timestamp |
Boolean | bool |
13.ADS
DataX 数据类型 | ADS 数据类型 |
---|---|
Long | int, tinyint, smallint, int, bigint |
Double | float, double, decimal |
String | varchar |
Date | date |
Boolean | bool |
14. Cassandra
DataX 数据类型 | Cassandra 数据类型 |
---|---|
Long | int, tinyint, smallint,varint,bigint,time |
Double | float, double, decimal |
String | ascii,varchar, text,uuid,timeuuid,duration,list,map,set,tuple,udt,inet |
Date | date, timestamp |
Boolean | bool |
Bytes | blob |
15.DRDS
DataX 数据类型 | DRDS 数据类型 |
---|---|
Long | int, tinyint, smallint, mediumint, int, bigint |
Double | float, double, decimal |
String | varchar, char, tinytext, text, mediumtext, longtext |
Date | date, datetime, timestamp, time, year |
Boolean | bit, bool |
Bytes | tinyblob, mediumblob, blob, longblob, varbinary |
16.Phoenix
DataX 数据类型 | Phoenix 数据类型 |
---|---|
String | CHAR, VARCHAR |
Bytes | BINARY, VARBINARY |
Bool | BOOLEAN |
Long | INTEGER, TINYINT, SMALLINT, BIGINT |
Double | FLOAT, DECIMAL, DOUBLE, |
Date | DATE, TIME, TIMESTAMP |
17.KingbaseES
DataX 数据类型 | KingbaseES 数据类型 |
---|---|
Long | bigint, bigserial, integer, smallint, serial |
Double | double precision, money, numeric, real |
String | varchar, char, text, bit, inet |
Date | date, time, timestamp |
Boolean | bool |
Bytes | bytea |