-
Notifications
You must be signed in to change notification settings - Fork 2.2k
[Core][jdk17] Support jdk17 #7086
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 49 commits
eed6f1a
c8cbcba
9ea4e6a
01b2606
1c5e9f1
919a3d9
8c71e08
b2153ca
76adc38
4afcc47
d6ec68d
41fc615
1ed9e93
1e72321
d502478
adc337e
85cfe75
b04c449
93c6817
0ff5dd9
21154d3
84c8c2f
a1ec356
82c6400
7201c36
575bef4
b6185af
97567b5
eb20539
1c4ba4b
68754a8
b9a080f
e5c872d
39e93e7
7a0d1c8
1520770
7a5ff10
ce7258f
af0c076
9b8acd8
ae87fd5
083ff53
8e1a2db
00eff65
057884f
b9c4a00
8621cd9
9681275
8bea308
a2ab07a
393a4c1
47605e3
6d4d167
b4f0160
801431a
49ce69c
c4649b7
1cc2f2f
a19632b
68c5bbc
74305b8
a18d381
ff05911
d5508fb
ea2c68b
c213e29
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,7 +17,7 @@ | |
|
|
||
| ### For SeaTunnel Zeta Engine | ||
|
|
||
| 1. You must ensure `seatunnel-hadoop3-3.1.4-uber.jar`, `aliyun-sdk-oss-3.4.1.jar`, `hadoop-aliyun-3.1.4.jar` and `jdom-1.1.jar` in `${SEATUNNEL_HOME}/lib/` dir. | ||
| 1. You must ensure `seatunnel-hadoop3-3.3.4-uber.jar`, `aliyun-sdk-oss-3.4.1.jar`, `hadoop-aliyun-3.1.4.jar` and `jdom-1.1.jar` in `${SEATUNNEL_HOME}/lib/` dir. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The hadoop version not match with hadoop-aliyun version |
||
|
|
||
| ## Key features | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,8 +23,10 @@ | |
| import org.apache.seatunnel.api.table.type.SeaTunnelRow; | ||
| import org.apache.seatunnel.api.table.type.SeaTunnelRowType; | ||
| import org.apache.seatunnel.common.exception.CommonError; | ||
| import org.apache.seatunnel.common.utils.DateTimeUtils; | ||
| import org.apache.seatunnel.common.utils.DateUtils; | ||
|
|
||
| import lombok.AllArgsConstructor; | ||
| import lombok.RequiredArgsConstructor; | ||
| import software.amazon.awssdk.core.SdkBytes; | ||
| import software.amazon.awssdk.services.dynamodb.model.AttributeValue; | ||
|
|
||
|
|
@@ -34,16 +36,29 @@ | |
| import java.time.LocalDate; | ||
| import java.time.LocalDateTime; | ||
| import java.time.LocalTime; | ||
| import java.time.format.DateTimeFormatter; | ||
| import java.time.format.DateTimeFormatterBuilder; | ||
| import java.time.temporal.ChronoField; | ||
| import java.time.temporal.TemporalAccessor; | ||
| import java.time.temporal.TemporalQueries; | ||
| import java.util.ArrayList; | ||
| import java.util.HashMap; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
|
|
||
| @AllArgsConstructor | ||
| @RequiredArgsConstructor | ||
| public class DefaultSeaTunnelRowDeserializer implements SeaTunnelRowDeserializer { | ||
|
|
||
| private final SeaTunnelRowType typeInfo; | ||
|
|
||
| public static DateTimeFormatter TIME_FORMAT = | ||
| new DateTimeFormatterBuilder() | ||
| .appendPattern("HH:mm:ss") | ||
| .appendFraction(ChronoField.NANO_OF_SECOND, 0, 9, true) | ||
| .toFormatter(); | ||
|
|
||
| public Map<String, DateTimeFormatter> fieldFormatterMap = new HashMap<>(); | ||
|
Comment on lines
+54
to
+60
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Format date format instead using toString. Strings generated in different jdk versions are inconsistent |
||
|
|
||
| @Override | ||
| public SeaTunnelRow deserialize(Map<String, AttributeValue> item) { | ||
| SeaTunnelDataType<?>[] seaTunnelDataTypes = typeInfo.getFieldTypes(); | ||
|
|
@@ -63,7 +78,9 @@ private List<Object> convertRow( | |
| } | ||
|
|
||
| private Object convert( | ||
| String field, SeaTunnelDataType<?> seaTunnelDataType, AttributeValue attributeValue) { | ||
| String fieldName, | ||
| SeaTunnelDataType<?> seaTunnelDataType, | ||
| AttributeValue attributeValue) { | ||
| if (attributeValue.type().equals(AttributeValue.Type.NUL)) { | ||
| return null; | ||
| } | ||
|
|
@@ -90,11 +107,26 @@ private Object convert( | |
| case STRING: | ||
| return attributeValue.s(); | ||
| case TIME: | ||
| return LocalTime.parse(attributeValue.s()); | ||
| return TIME_FORMAT.parse(attributeValue.s()); | ||
| case DATE: | ||
| return LocalDate.parse(attributeValue.s()); | ||
| DateTimeFormatter dateFormatter = fieldFormatterMap.get(fieldName); | ||
| if (dateFormatter == null) { | ||
| dateFormatter = DateUtils.matchDateFormatter(attributeValue.s()); | ||
| fieldFormatterMap.put(fieldName, dateFormatter); | ||
| } | ||
|
|
||
| return dateFormatter.parse(attributeValue.s()).query(TemporalQueries.localDate()); | ||
| case TIMESTAMP: | ||
| return LocalDateTime.parse(attributeValue.s()); | ||
| DateTimeFormatter dateTimeFormatter = fieldFormatterMap.get(fieldName); | ||
| if (dateTimeFormatter == null) { | ||
| dateTimeFormatter = DateTimeUtils.matchDateTimeFormatter(attributeValue.s()); | ||
| fieldFormatterMap.put(fieldName, dateTimeFormatter); | ||
| } | ||
|
|
||
| TemporalAccessor parsedTimestamp = dateTimeFormatter.parse(attributeValue.s()); | ||
| LocalTime localTime = parsedTimestamp.query(TemporalQueries.localTime()); | ||
| LocalDate localDate = parsedTimestamp.query(TemporalQueries.localDate()); | ||
| return LocalDateTime.of(localDate, localTime); | ||
| case BYTES: | ||
| return attributeValue.b().asByteArray(); | ||
| case MAP: | ||
|
|
@@ -106,7 +138,7 @@ private Object convert( | |
| seatunnelMap.put( | ||
| s, | ||
| convert( | ||
| field, | ||
| fieldName, | ||
| ((MapType) seaTunnelDataType).getValueType(), | ||
| attributeValueInfo)); | ||
| }); | ||
|
|
@@ -126,7 +158,7 @@ private Object convert( | |
| array, | ||
| index, | ||
| convert( | ||
| field, | ||
| fieldName, | ||
| ((ArrayType<?, ?>) seaTunnelDataType).getElementType(), | ||
| datas.get(index))); | ||
| } | ||
|
|
@@ -149,7 +181,7 @@ private Object convert( | |
| return array; | ||
| default: | ||
| throw CommonError.convertToSeaTunnelTypeError( | ||
| "AmazonDynamodb", seaTunnelDataType.getSqlType().toString(), field); | ||
| "AmazonDynamodb", seaTunnelDataType.getSqlType().toString(), fieldName); | ||
| } | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we update hive-exec and libfb303 too?