跳到主要内容
最后于 更新

Hive 与 Doris 数据类型映射

以下表格描述 Doris 4.2(branch-4.2)读取 Hive 外部表 Schema 时的类型映射。写入外部表时还受目标表 Schema 和写入能力限制,不能直接将读取映射反向使用。

Hive TypeDoris TypeComment
booleanboolean
tinyinttinyint
smallintsmallint
intint
bigintbigint
datedate
timestampdatetime(6)固定映射到精度为 6 的 datetime
floatfloat
doubledouble
decimal(P, S)decimal(P, S)如果未指定精度,默认为 decimal(9, 0)
char(N)char(N)
varchar(N)varchar(N)
stringstring
binaryVARBINARY自 4.1.5 版本起固定映射为 VARBINARY。
timestamp with local time zoneTIMESTAMPTZ(6)自 4.1.5 版本起固定映射为 TIMESTAMPTZ(6)。精度最高为 6,超过的部分会丢失。
arrayarray
mapmap
structstruct
otherunsupported

使用说明​

复合类型的子字段递归使用上述映射。TIMESTAMPTZ 表示时间点,按会话 time_zone 展示。

Hive Catalog 从 Hive Metastore 的类型字符串推断 Schema。timestamp 映射为 DATETIME(6),不会因为底层文件保存了纳秒就自动映射为 TIMESTAMP_NS。uniontype 等未列为支持的类型不受支持。

实现依据:HiveMetaStoreClientHelper.java(branch-4.2)。