Skip to content

Commit e18bfea

Browse files
hailin0Hisoka-X
andauthored
[Feature][API] Support timestamp with timezone offset (#8367)
Co-authored-by: Jia Fan <fanjiaeminem@qq.com>
1 parent d72b3c8 commit e18bfea

File tree

17 files changed

+279
-47
lines changed

17 files changed

+279
-47
lines changed

docs/en/concept/schema-feature.md

Lines changed: 20 additions & 19 deletions
Large diffs are not rendered by default.

docs/zh/concept/schema-feature.md

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -70,25 +70,26 @@ columns = [
7070

7171
#### 目前支持哪些类型
7272

73-
| 数据类型 | Java中的值类型 | 描述 |
74-
|:----------|:---------------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
75-
| string | `java.lang.String` | 字符串 |
76-
| boolean | `java.lang.Boolean` | 布尔 |
77-
| tinyint | `java.lang.Byte` | 常规-128 至 127 。 0 到 255 无符号*。 指定括号中的最大位数。 |
78-
| smallint | `java.lang.Short` | 常规-32768 至 32767。 0 到 65535 无符号*。 指定括号中的最大位数。 |
79-
| int | `java.lang.Integer` | 允许从 -2,147,483,648 到 2,147,483,647 的所有数字。 |
80-
| bigint | `java.lang.Long` | 允许 -9,223,372,036,854,775,808 和 9,223,372,036,854,775,807 之间的所有数字。 |
81-
| float | `java.lang.Float` | 从-1.79E+308 到 1.79E+308浮点精度数值数据。 |
82-
| double | `java.lang.Double` | 双精度浮点。 处理大多数小数。 |
83-
| decimal | `java.math.BigDecimal` | Double 类型存储为字符串,允许固定小数点。 |
84-
| null | `java.lang.Void` | null |
85-
| bytes | `byte[]` | 字节。 |
86-
| date | `java.time.LocalDate` | 仅存储日期。从0001年1月1日到9999 年 12 月 31 日。 |
87-
| time | `java.time.LocalTime` | 仅存储时间。精度为 100 纳秒。 |
88-
| timestamp | `java.time.LocalDateTime` | 存储一个唯一的编号,每当创建或修改行时都会更新该编号。 时间戳基于内部时钟,与实际时间不对应。 每个表只能有一个时间戳变量。 |
89-
| row | `org.apache.seatunnel.api.table.type.SeaTunnelRow` | 行类型,可以嵌套。 |
90-
| map | `java.util.Map` | Map 是将键映射到值的对象。 键类型包括: `int` `string` `boolean` `tinyint` `smallint` `bigint` `float` `double` `decimal` `date` `time` `timestamp` `null` , and the value type includes `int` `string` `boolean` `tinyint` `smallint` `bigint` `float` `double` `decimal` `date` `time` `timestamp` `null` `array` `map` `row`. |
91-
| array | `ValueType[]` | 数组是一种表示元素集合的数据类型。 元素类型包括: `int` `string` `boolean` `tinyint` `smallint` `bigint` `float` `double`. |
73+
| 数据类型 | Java中的值类型 | 描述 |
74+
|:-------------|:---------------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
75+
| string | `java.lang.String` | 字符串 |
76+
| boolean | `java.lang.Boolean` | 布尔 |
77+
| tinyint | `java.lang.Byte` | 常规-128 至 127 。 0 到 255 无符号*。 指定括号中的最大位数。 |
78+
| smallint | `java.lang.Short` | 常规-32768 至 32767。 0 到 65535 无符号*。 指定括号中的最大位数。 |
79+
| int | `java.lang.Integer` | 允许从 -2,147,483,648 到 2,147,483,647 的所有数字。 |
80+
| bigint | `java.lang.Long` | 允许 -9,223,372,036,854,775,808 和 9,223,372,036,854,775,807 之间的所有数字。 |
81+
| float | `java.lang.Float` | 从-1.79E+308 到 1.79E+308浮点精度数值数据。 |
82+
| double | `java.lang.Double` | 双精度浮点。 处理大多数小数。 |
83+
| decimal | `java.math.BigDecimal` | Double 类型存储为字符串,允许固定小数点。 |
84+
| null | `java.lang.Void` | null |
85+
| bytes | `byte[]` | 字节。 |
86+
| date | `java.time.LocalDate` | 仅存储日期。从0001年1月1日到9999 年 12 月 31 日。 |
87+
| time | `java.time.LocalTime` | 仅存储时间。精度为 100 纳秒。 |
88+
| timestamp | `java.time.LocalDateTime` | 存储不带时区的日期和时间信息,表示事件发生的本地时间。不包含任何偏移量或时区相关信息。 |
89+
| timestamp_tz | `java.time.OffsetDateTime` | 存储带有 UTC 偏移量的日期和时间信息,包含本地日期时间和 UTC 偏移量。在处理多时区场景时,可以提供更精确的时间信息。 |
90+
| row | `org.apache.seatunnel.api.table.type.SeaTunnelRow` | 行类型,可以嵌套。 |
91+
| map | `java.util.Map` | Map 是将键映射到值的对象。 键类型包括: `int` `string` `boolean` `tinyint` `smallint` `bigint` `float` `double` `decimal` `date` `time` `timestamp` `null` , and the value type includes `int` `string` `boolean` `tinyint` `smallint` `bigint` `float` `double` `decimal` `date` `time` `timestamp` `null` `array` `map` `row`. |
92+
| array | `ValueType[]` | 数组是一种表示元素集合的数据类型。 元素类型包括: `int` `string` `boolean` `tinyint` `smallint` `bigint` `float` `double`. |
9293

9394
#### 如何声明支持的类型
9495

seatunnel-api/src/main/java/org/apache/seatunnel/api/table/catalog/SeaTunnelDataTypeConvertorUtil.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ public static SeaTunnelDataType<?> deserializeSeaTunnelDataType(
7979
return LocalTimeType.LOCAL_TIME_TYPE;
8080
case TIMESTAMP:
8181
return LocalTimeType.LOCAL_DATE_TIME_TYPE;
82+
case TIMESTAMP_TZ:
83+
return LocalTimeType.OFFSET_DATE_TIME_TYPE;
8284
case MAP:
8385
return parseMapType(field, columnType);
8486
case BINARY_VECTOR:

0 commit comments

Comments
 (0)