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/03/10 03:12:42 UTC

[GitHub] [incubator-inlong] kipshi opened a new pull request #3036: [INLONG-3033] Add sourceFieldName in sinkFields

kipshi opened a new pull request #3036:
URL: https://github.com/apache/incubator-inlong/pull/3036


   ### Title Name: [INLONG-3033] Add sourceFieldName in sinkFields
   
   where *XYZ* should be replaced by the actual issue number.
   
   Fixes #3033 
   
   ### Motivation
   
   ### Modifications
   
   ### Verifying this change
   
   - [ ] Make sure that the change passes the CI checks.
   
   *(Please pick either of the following options)*
   
   This change is a trivial rework / code cleanup without any test coverage.
   
   *(or)*
   
   This change is already covered by existing tests, such as *(please describe tests)*.
   
   *(or)*
   
   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 followup 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] [incubator-inlong] kipshi commented on a change in pull request #3036: [INLONG-3033] Add sourceFieldName in sinkFields

Posted by GitBox <gi...@apache.org>.
kipshi commented on a change in pull request #3036:
URL: https://github.com/apache/incubator-inlong/pull/3036#discussion_r823314425



##########
File path: inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/util/InlongStreamSinkTransfer.java
##########
@@ -244,21 +230,32 @@ private static HiveSinkRequest createHiveRequest(StreamSink streamSink, InlongSt
         hiveSinkRequest.setPrimaryPartition(hiveSink.getPrimaryPartition());
         hiveSinkRequest.setSecondaryPartition(hiveSink.getSecondaryPartition());
         if (CollectionUtils.isNotEmpty(hiveSink.getStreamFields())) {
-            List<SinkFieldRequest> fieldRequests = hiveSink.getStreamFields()
-                    .stream()
-                    .map(streamField -> {
-                        SinkFieldRequest storageFieldRequest = new SinkFieldRequest();
-                        storageFieldRequest.setFieldName(streamField.getFieldName());
-                        storageFieldRequest.setFieldType(streamField.getFieldType().toString());
-                        storageFieldRequest.setFieldComment(streamField.getFieldComment());
-                        return storageFieldRequest;
-                    })
-                    .collect(Collectors.toList());
+            List<SinkFieldRequest> fieldRequests = createSinkFields(streamSink.getStreamFields(),
+                    streamInfo.getFieldList());
             hiveSinkRequest.setFieldList(fieldRequests);
         }
         return hiveSinkRequest;
     }
 
+    private static List<SinkFieldRequest> createSinkFields(List<StreamField> sinkFields,
+            List<InlongStreamFieldInfo> sourceFields) {
+        List<SinkFieldRequest> sinkFieldRequests = Lists.newArrayList();
+        for (int i = 0; i < sinkFields.size(); i++) {
+            SinkFieldRequest sinkFieldRequest = new SinkFieldRequest();
+            StreamField sinkField = sinkFields.get(i);
+            sinkFieldRequest.setFieldName(sinkField.getFieldName());
+            sinkFieldRequest.setFieldType(sinkField.getFieldType().toString());
+            sinkFieldRequest.setFieldComment(sinkField.getFieldComment());
+            if (sourceFields.size() > i && sourceFields.get(i) != null) {
+                InlongStreamFieldInfo sourceField = sourceFields.get(i);
+                sinkFieldRequest.setSourceFieldName(sourceField.getFieldName());
+                sinkFieldRequest.setSourceFieldType(sourceField.getFieldType());
+            }
+            sinkFieldRequests.add(sinkFieldRequest);
+        }
+        return sinkFieldRequests;
+    }
+

Review comment:
       It is now, and yunqingmo will add Mappings after this pr is merged




-- 
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] [incubator-inlong] gong commented on a change in pull request #3036: [INLONG-3033] Add sourceFieldName in sinkFields

Posted by GitBox <gi...@apache.org>.
gong commented on a change in pull request #3036:
URL: https://github.com/apache/incubator-inlong/pull/3036#discussion_r823310918



##########
File path: inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/util/InlongStreamSinkTransfer.java
##########
@@ -244,21 +230,32 @@ private static HiveSinkRequest createHiveRequest(StreamSink streamSink, InlongSt
         hiveSinkRequest.setPrimaryPartition(hiveSink.getPrimaryPartition());
         hiveSinkRequest.setSecondaryPartition(hiveSink.getSecondaryPartition());
         if (CollectionUtils.isNotEmpty(hiveSink.getStreamFields())) {
-            List<SinkFieldRequest> fieldRequests = hiveSink.getStreamFields()
-                    .stream()
-                    .map(streamField -> {
-                        SinkFieldRequest storageFieldRequest = new SinkFieldRequest();
-                        storageFieldRequest.setFieldName(streamField.getFieldName());
-                        storageFieldRequest.setFieldType(streamField.getFieldType().toString());
-                        storageFieldRequest.setFieldComment(streamField.getFieldComment());
-                        return storageFieldRequest;
-                    })
-                    .collect(Collectors.toList());
+            List<SinkFieldRequest> fieldRequests = createSinkFields(streamSink.getStreamFields(),
+                    streamInfo.getFieldList());
             hiveSinkRequest.setFieldList(fieldRequests);
         }
         return hiveSinkRequest;
     }
 
+    private static List<SinkFieldRequest> createSinkFields(List<StreamField> sinkFields,
+            List<InlongStreamFieldInfo> sourceFields) {
+        List<SinkFieldRequest> sinkFieldRequests = Lists.newArrayList();
+        for (int i = 0; i < sinkFields.size(); i++) {
+            SinkFieldRequest sinkFieldRequest = new SinkFieldRequest();
+            StreamField sinkField = sinkFields.get(i);
+            sinkFieldRequest.setFieldName(sinkField.getFieldName());
+            sinkFieldRequest.setFieldType(sinkField.getFieldType().toString());
+            sinkFieldRequest.setFieldComment(sinkField.getFieldComment());
+            if (sourceFields.size() > i && sourceFields.get(i) != null) {
+                InlongStreamFieldInfo sourceField = sourceFields.get(i);
+                sinkFieldRequest.setSourceFieldName(sourceField.getFieldName());
+                sinkFieldRequest.setSourceFieldType(sourceField.getFieldType());
+            }
+            sinkFieldRequests.add(sinkFieldRequest);
+        }
+        return sinkFieldRequests;
+    }
+

Review comment:
       Is field mapping created by order of sink field list and stream field list ? 




-- 
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] [incubator-inlong] healchow merged pull request #3036: [INLONG-3033][Manager] Add sourceFieldName in sinkFields

Posted by GitBox <gi...@apache.org>.
healchow merged pull request #3036:
URL: https://github.com/apache/incubator-inlong/pull/3036


   


-- 
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] [incubator-inlong] kipshi commented on a change in pull request #3036: [INLONG-3033] Add sourceFieldName in sinkFields

Posted by GitBox <gi...@apache.org>.
kipshi commented on a change in pull request #3036:
URL: https://github.com/apache/incubator-inlong/pull/3036#discussion_r823306289



##########
File path: inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/util/InlongStreamSinkTransfer.java
##########
@@ -244,21 +230,32 @@ private static HiveSinkRequest createHiveRequest(StreamSink streamSink, InlongSt
         hiveSinkRequest.setPrimaryPartition(hiveSink.getPrimaryPartition());
         hiveSinkRequest.setSecondaryPartition(hiveSink.getSecondaryPartition());
         if (CollectionUtils.isNotEmpty(hiveSink.getStreamFields())) {
-            List<SinkFieldRequest> fieldRequests = hiveSink.getStreamFields()
-                    .stream()
-                    .map(streamField -> {
-                        SinkFieldRequest storageFieldRequest = new SinkFieldRequest();
-                        storageFieldRequest.setFieldName(streamField.getFieldName());
-                        storageFieldRequest.setFieldType(streamField.getFieldType().toString());
-                        storageFieldRequest.setFieldComment(streamField.getFieldComment());
-                        return storageFieldRequest;
-                    })
-                    .collect(Collectors.toList());
+            List<SinkFieldRequest> fieldRequests = createSinkFields(streamSink.getStreamFields(),
+                    streamInfo.getFieldList());
             hiveSinkRequest.setFieldList(fieldRequests);
         }
         return hiveSinkRequest;
     }
 
+    private static List<SinkFieldRequest> createSinkFields(List<StreamField> sinkFields,

Review comment:
       not necessary, StreamField is class for field definition in Client




-- 
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] [incubator-inlong] healchow commented on a change in pull request #3036: [INLONG-3033] Add sourceFieldName in sinkFields

Posted by GitBox <gi...@apache.org>.
healchow commented on a change in pull request #3036:
URL: https://github.com/apache/incubator-inlong/pull/3036#discussion_r823303358



##########
File path: inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/util/InlongStreamSinkTransfer.java
##########
@@ -244,21 +230,32 @@ private static HiveSinkRequest createHiveRequest(StreamSink streamSink, InlongSt
         hiveSinkRequest.setPrimaryPartition(hiveSink.getPrimaryPartition());
         hiveSinkRequest.setSecondaryPartition(hiveSink.getSecondaryPartition());
         if (CollectionUtils.isNotEmpty(hiveSink.getStreamFields())) {
-            List<SinkFieldRequest> fieldRequests = hiveSink.getStreamFields()
-                    .stream()
-                    .map(streamField -> {
-                        SinkFieldRequest storageFieldRequest = new SinkFieldRequest();
-                        storageFieldRequest.setFieldName(streamField.getFieldName());
-                        storageFieldRequest.setFieldType(streamField.getFieldType().toString());
-                        storageFieldRequest.setFieldComment(streamField.getFieldComment());
-                        return storageFieldRequest;
-                    })
-                    .collect(Collectors.toList());
+            List<SinkFieldRequest> fieldRequests = createSinkFields(streamSink.getStreamFields(),
+                    streamInfo.getFieldList());
             hiveSinkRequest.setFieldList(fieldRequests);
         }
         return hiveSinkRequest;
     }
 
+    private static List<SinkFieldRequest> createSinkFields(List<StreamField> sinkFields,

Review comment:
       The `StreamField` may be named `SinkField`?




-- 
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