You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/12/24 03:09:26 UTC
[GitHub] [inlong] featzhang opened a new pull request, #7050: [INLONG-7049][Manager] Support complex data types in Hudi Sink
featzhang opened a new pull request, #7050:
URL: https://github.com/apache/inlong/pull/7050
### Prepare a Pull Request
*[INLONG-7049][Manager] Support complex data types in Hudi Sink*
- Fixes #7049
### Motivation
Adapt to hive data types in hudi sink
### Modifications
*Describe the modifications you've done.*
### Verifying this change
*(Please pick either of the following options)*
- [x] This change is a trivial rework/code cleanup without any test coverage.
- [ ] This change is already covered by existing tests, such as:
*(please describe tests)*
- [ ] This change added tests and can be verified as follows:
*(example:)*
- *Added integration tests for end-to-end deployment with large payloads (10MB)*
- *Extended integration test for recovery after broker failure*
### Documentation
- Does this pull request introduce a new feature? (yes / no)
- If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
- If a feature is not applicable for documentation, explain why?
- If a feature is not documented yet in this PR, please create a follow-up issue for adding the documentation
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] healchow merged pull request #7050: [INLONG-7049][Manager] Support complex data types in Hudi Sink
Posted by GitBox <gi...@apache.org>.
healchow merged PR #7050:
URL: https://github.com/apache/inlong/pull/7050
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] healchow commented on a diff in pull request #7050: [INLONG-7049][Manager] Support complex data types in Hudi Sink
Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #7050:
URL: https://github.com/apache/inlong/pull/7050#discussion_r1056897258
##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/resource/sink/hudi/HudiTypeConverter.java:
##########
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.inlong.manager.service.resource.sink.hudi;
+
+import java.util.Optional;
+import org.apache.inlong.manager.pojo.sink.hudi.HudiColumnInfo;
+import org.apache.inlong.manager.pojo.sink.hudi.HudiType;
+
+/**
+ * Converter between Java type and Hive type that reflects the behavior before
+ *
+ * <p>This converter reflects the old behavior that includes:
+ *
+ * <ul>
+ * <li>Use old {@code java.sql.*} time classes for time data types.
+ * <li>Only support millisecond precision for timestamps or day-time intervals.
+ * <li>Let variable precision and scale for decimal types pass through the planner.
+ * <li>Inconsistent nullability. Most types are nullable even though type information does not
+ * support it.
+ * <li>Let POJOs, case classes, and tuples pass through the planner.
+ * </ul>
+ *
+ * <p>Any changes here need to be applied to the legacy planner as well.
+ * {@see org.apache.flink.table.types.utils.TypeInfoDataTypeConverter}
+ */
+public class HudiTypeConverter {
+
+ /**
+ * Converter field type of column to Hive field type.
+ */
+ public static String convert(HudiColumnInfo column) {
+ return Optional.ofNullable(column)
+ .map(HudiColumnInfo::getType)
+ .map(String::toLowerCase)
+ .map(HudiType::forType)
+ .map(hudiType -> {
Review Comment:
Can we use the map only once to complete the conversion?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] healchow commented on a diff in pull request #7050: [INLONG-7049][Manager] Support complex data types in Hudi Sink
Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #7050:
URL: https://github.com/apache/inlong/pull/7050#discussion_r1057155189
##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/resource/sink/hudi/HudiTypeConverter.java:
##########
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.inlong.manager.service.resource.sink.hudi;
+
+import org.apache.inlong.manager.pojo.sink.hudi.HudiColumnInfo;
+import org.apache.inlong.manager.pojo.sink.hudi.HudiType;
+
+import java.util.Optional;
+
+/**
+ * Converter between Java type and Hive type that reflects the behavior before This converter reflects the old behavior
+ * that includes:
+ * <ul>
+ * <li>Use old java.sql.* time classes for time data types.
+ * <li>Only support millisecond precision for timestamps or day-time intervals.
+ * <li>Let variable precision and scale for decimal types pass through the planner.
+ * </ul>
+ * {@see org.apache.flink.table.types.utils.TypeInfoDataTypeConverter}
+ */
+public class HudiTypeConverter {
+
+ /**
+ * Converter field type of column to Hive field type.
+ */
+ public static String convert(HudiColumnInfo column) {
+ return Optional.ofNullable(column)
+ .map(HudiColumnInfo::getType)
+ .map(HudiType::forType)
Review Comment:
Using many maps will lead to low efficiency.
It is recommended to compress the following two maps into one:
```
.map(HudiColumnInfo::getType)
.map(HudiType::forType)
```
Because the 'HudiType:: forType' method will throw an exception.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] dockerzhang commented on pull request #7050: [INLONG-7049][Manager] Support complex data types in Hudi Sink
Posted by GitBox <gi...@apache.org>.
dockerzhang commented on PR #7050:
URL: https://github.com/apache/inlong/pull/7050#issuecomment-1364530678
@featzhang please update the doc at the same time.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] featzhang commented on a diff in pull request #7050: [INLONG-7049][Manager] Support complex data types in Hudi Sink
Posted by GitBox <gi...@apache.org>.
featzhang commented on code in PR #7050:
URL: https://github.com/apache/inlong/pull/7050#discussion_r1057118541
##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/resource/sink/hudi/HudiTypeConverter.java:
##########
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.inlong.manager.service.resource.sink.hudi;
+
+import java.util.Optional;
+import org.apache.inlong.manager.pojo.sink.hudi.HudiColumnInfo;
+import org.apache.inlong.manager.pojo.sink.hudi.HudiType;
+
+/**
+ * Converter between Java type and Hive type that reflects the behavior before
+ *
+ * <p>This converter reflects the old behavior that includes:
+ *
+ * <ul>
+ * <li>Use old {@code java.sql.*} time classes for time data types.
+ * <li>Only support millisecond precision for timestamps or day-time intervals.
+ * <li>Let variable precision and scale for decimal types pass through the planner.
+ * <li>Inconsistent nullability. Most types are nullable even though type information does not
+ * support it.
+ * <li>Let POJOs, case classes, and tuples pass through the planner.
+ * </ul>
+ *
+ * <p>Any changes here need to be applied to the legacy planner as well.
+ * {@see org.apache.flink.table.types.utils.TypeInfoDataTypeConverter}
+ */
Review Comment:
Some of the logic in the document is used in downstream flink jobs, I has removed it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] featzhang commented on a diff in pull request #7050: [INLONG-7049][Manager] Support complex data types in Hudi Sink
Posted by GitBox <gi...@apache.org>.
featzhang commented on code in PR #7050:
URL: https://github.com/apache/inlong/pull/7050#discussion_r1057119534
##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/resource/sink/hudi/HudiTypeConverter.java:
##########
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.inlong.manager.service.resource.sink.hudi;
+
+import java.util.Optional;
+import org.apache.inlong.manager.pojo.sink.hudi.HudiColumnInfo;
+import org.apache.inlong.manager.pojo.sink.hudi.HudiType;
+
+/**
+ * Converter between Java type and Hive type that reflects the behavior before
+ *
+ * <p>This converter reflects the old behavior that includes:
+ *
+ * <ul>
+ * <li>Use old {@code java.sql.*} time classes for time data types.
+ * <li>Only support millisecond precision for timestamps or day-time intervals.
+ * <li>Let variable precision and scale for decimal types pass through the planner.
+ * <li>Inconsistent nullability. Most types are nullable even though type information does not
+ * support it.
+ * <li>Let POJOs, case classes, and tuples pass through the planner.
+ * </ul>
+ *
+ * <p>Any changes here need to be applied to the legacy planner as well.
+ * {@see org.apache.flink.table.types.utils.TypeInfoDataTypeConverter}
+ */
+public class HudiTypeConverter {
+
+ /**
+ * Converter field type of column to Hive field type.
+ */
+ public static String convert(HudiColumnInfo column) {
+ return Optional.ofNullable(column)
+ .map(HudiColumnInfo::getType)
+ .map(String::toLowerCase)
+ .map(HudiType::forType)
+ .map(hudiType -> {
Review Comment:
The use of `map` here is to achieve short-circuiting. Except for lowcase, other steps may be npe, or an exception may be thrown.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] gong commented on a diff in pull request #7050: [INLONG-7049][Manager] Support complex data types in Hudi Sink
Posted by GitBox <gi...@apache.org>.
gong commented on code in PR #7050:
URL: https://github.com/apache/inlong/pull/7050#discussion_r1057026265
##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/resource/sink/hudi/HudiTypeConverter.java:
##########
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.inlong.manager.service.resource.sink.hudi;
+
+import java.util.Optional;
+import org.apache.inlong.manager.pojo.sink.hudi.HudiColumnInfo;
+import org.apache.inlong.manager.pojo.sink.hudi.HudiType;
+
+/**
+ * Converter between Java type and Hive type that reflects the behavior before
+ *
+ * <p>This converter reflects the old behavior that includes:
+ *
+ * <ul>
+ * <li>Use old {@code java.sql.*} time classes for time data types.
+ * <li>Only support millisecond precision for timestamps or day-time intervals.
+ * <li>Let variable precision and scale for decimal types pass through the planner.
+ * <li>Inconsistent nullability. Most types are nullable even though type information does not
+ * support it.
+ * <li>Let POJOs, case classes, and tuples pass through the planner.
+ * </ul>
+ *
+ * <p>Any changes here need to be applied to the legacy planner as well.
+ * {@see org.apache.flink.table.types.utils.TypeInfoDataTypeConverter}
+ */
+public class HudiTypeConverter {
+
+ /**
+ * Converter field type of column to Hive field type.
+ */
+ public static String convert(HudiColumnInfo column) {
+ return Optional.ofNullable(column)
+ .map(HudiColumnInfo::getType)
+ .map(String::toLowerCase)
+ .map(HudiType::forType)
Review Comment:
`forType` has used `equalsIgnoreCase`, not need use `toLowerCase`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] gong commented on a diff in pull request #7050: [INLONG-7049][Manager] Support complex data types in Hudi Sink
Posted by GitBox <gi...@apache.org>.
gong commented on code in PR #7050:
URL: https://github.com/apache/inlong/pull/7050#discussion_r1057025864
##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/resource/sink/hudi/HudiTypeConverter.java:
##########
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.inlong.manager.service.resource.sink.hudi;
+
+import java.util.Optional;
+import org.apache.inlong.manager.pojo.sink.hudi.HudiColumnInfo;
+import org.apache.inlong.manager.pojo.sink.hudi.HudiType;
+
+/**
+ * Converter between Java type and Hive type that reflects the behavior before
+ *
+ * <p>This converter reflects the old behavior that includes:
+ *
+ * <ul>
+ * <li>Use old {@code java.sql.*} time classes for time data types.
+ * <li>Only support millisecond precision for timestamps or day-time intervals.
+ * <li>Let variable precision and scale for decimal types pass through the planner.
+ * <li>Inconsistent nullability. Most types are nullable even though type information does not
+ * support it.
+ * <li>Let POJOs, case classes, and tuples pass through the planner.
+ * </ul>
+ *
+ * <p>Any changes here need to be applied to the legacy planner as well.
+ * {@see org.apache.flink.table.types.utils.TypeInfoDataTypeConverter}
+ */
Review Comment:
Description is irrelevant?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] featzhang commented on pull request #7050: [INLONG-7049][Manager] Support complex data types in Hudi Sink
Posted by GitBox <gi...@apache.org>.
featzhang commented on PR #7050:
URL: https://github.com/apache/inlong/pull/7050#issuecomment-1364533371
> @featzhang please update the doc at the same time.
The documentation already exists:
https://inlong.apache.org/docs/next/data_node/load_node/hudi#data-type-mapping
https://inlong.apache.org/zh-CN/docs/next/data_node/load_node/hudi/#%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B%E6%98%A0%E5%B0%84
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org