为了便于 SQL 编写,快速从 Hive/Spark 语法切换到 DLC 统一的 SQL,我们提供了 SQL 的隐式转化能力,转化列表如下:
I:implicit cast,E: explicit cast,--: not allowed
From-To | null | boolean | tinyint | smallint | int | bigint | decimal | float/real | double | interval | date | time | timestamp | [var]char | [var]binary |
null | Ι | Ι | Ι | Ι | Ι | Ι | Ι | Ι | Ι | Ι | Ι | Ι | Ι | Ι | Ι |
boolean | -- | Ι | E | E | E | E | E | E | E | -- | -- | -- | -- | Ι | -- |
tinyint | -- | E | Ι | Ι | Ι | Ι | Ι | Ι | Ι | E | -- | -- | E | Ι | -- |
smallint | -- | E | Ι | Ι | Ι | Ι | Ι | Ι | Ι | E | -- | -- | E | Ι | -- |
int | -- | E | Ι | Ι | Ι | Ι | Ι | Ι | Ι | E | -- | -- | E | Ι | -- |
bigint | -- | E | Ι | Ι | Ι | Ι | Ι | Ι | Ι | E | -- | -- | E | Ι | -- |
decimal | -- | E | Ι | Ι | Ι | Ι | Ι | Ι | Ι | E | -- | -- | E | Ι | -- |
float/real | -- | E | Ι | Ι | Ι | Ι | Ι | Ι | Ι | -- | -- | -- | E | Ι | -- |
double | -- | E | Ι | Ι | Ι | Ι | Ι | Ι | Ι | -- | -- | -- | E | Ι | -- |
interval | -- | -- | E | E | E | E | E | -- | -- | Ι | -- | -- | -- | E | -- |
date | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | Ι | -- | Ι | Ι | -- |
time | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | Ι | E | Ι | -- |
timestamp | -- | -- | E | E | E | E | E | E | E | -- | Ι | E | Ι | Ι | -- |
[var]char | -- | E | Ι | Ι | Ι | Ι | Ι | Ι | Ι | Ι | Ι | Ι | Ι | Ι | Ι |
[var]binary | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | E | E | E | Ι | Ι |