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/09/06 16:26:46 UTC

[GitHub] [inlong] vernedeng opened a new pull request, #5809: [INLONG-5808][SDK] SortSdk support parse InlongMsg

vernedeng opened a new pull request, #5809:
URL: https://github.com/apache/inlong/pull/5809

   ### Prepare a Pull Request
   *(Change the title refer to the following example)*
   
   - Title Example: [INLONG-XYZ][Component] Title of the pull request
   
   *(The following *XYZ* should be replaced by the actual [GitHub Issue](https://github.com/apache/inlong/issues) number)*
   
   - Fixes #5808
   
   ### Motivation
   
   *Explain here the context, and why you're making that change. What is the problem you're trying to solve?*
   
   ### Modifications
   
   *Describe the modifications you've done.*
   
   ### Verifying this change
   
   *(Please pick either of the following options)*
   
   - [ ] 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] vernedeng commented on a diff in pull request #5809: [INLONG-5808][SDK] SortSdk support parse InlongMsg

Posted by GitBox <gi...@apache.org>.
vernedeng commented on code in PR #5809:
URL: https://github.com/apache/inlong/pull/5809#discussion_r966596685


##########
inlong-sdk/sort-sdk/src/main/java/org/apache/inlong/sdk/sort/util/StringUtil.java:
##########
@@ -106,4 +245,26 @@ public static String formatDate(Date date) {
         return sdf.format(date);
     }
 
+    public static long parseDateTime(String value) {
+        try {
+            if (value.length() < 8) {
+                return -1;
+            } else if (value.length() <= 9) {
+                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
+                Date date = simpleDateFormat.parse(value.substring(0, 8));
+                return new Timestamp(date.getTime()).getTime();
+            } else if (value.length() <= 11) {
+                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHH");
+                Date date = simpleDateFormat.parse(value.substring(0, 10));
+                return new Timestamp(date.getTime()).getTime();
+            } else {
+                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmm");
+                Date date = simpleDateFormat.parse(value.substring(0, 12));
+                return new Timestamp(date.getTime()).getTime();
+            }
+        } catch (ParseException e) {
+            throw new IllegalArgumentException("Unexpected time format : " + value + ".");

Review Comment:
   fixed, thx



-- 
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 #5809: [INLONG-5808][SDK] SortSdk support parse InlongMsg

Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #5809:
URL: https://github.com/apache/inlong/pull/5809#discussion_r966590035


##########
inlong-sdk/sort-sdk/src/main/java/org/apache/inlong/sdk/sort/util/StringUtil.java:
##########
@@ -106,4 +245,26 @@ public static String formatDate(Date date) {
         return sdf.format(date);
     }
 
+    public static long parseDateTime(String value) {
+        try {
+            if (value.length() < 8) {
+                return -1;
+            } else if (value.length() <= 9) {
+                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
+                Date date = simpleDateFormat.parse(value.substring(0, 8));
+                return new Timestamp(date.getTime()).getTime();
+            } else if (value.length() <= 11) {
+                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHH");
+                Date date = simpleDateFormat.parse(value.substring(0, 10));
+                return new Timestamp(date.getTime()).getTime();
+            } else {
+                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmm");
+                Date date = simpleDateFormat.parse(value.substring(0, 12));
+                return new Timestamp(date.getTime()).getTime();
+            }
+        } catch (ParseException e) {
+            throw new IllegalArgumentException("Unexpected time format : " + value + ".");

Review Comment:
   Not need append `.` at the end of exception message.



-- 
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 #5809: [INLONG-5808][SDK] SortSdk support parse InlongMsg

Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #5809:
URL: https://github.com/apache/inlong/pull/5809#discussion_r966590035


##########
inlong-sdk/sort-sdk/src/main/java/org/apache/inlong/sdk/sort/util/StringUtil.java:
##########
@@ -106,4 +245,26 @@ public static String formatDate(Date date) {
         return sdf.format(date);
     }
 
+    public static long parseDateTime(String value) {
+        try {
+            if (value.length() < 8) {
+                return -1;
+            } else if (value.length() <= 9) {
+                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
+                Date date = simpleDateFormat.parse(value.substring(0, 8));
+                return new Timestamp(date.getTime()).getTime();
+            } else if (value.length() <= 11) {
+                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHH");
+                Date date = simpleDateFormat.parse(value.substring(0, 10));
+                return new Timestamp(date.getTime()).getTime();
+            } else {
+                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmm");
+                Date date = simpleDateFormat.parse(value.substring(0, 12));
+                return new Timestamp(date.getTime()).getTime();
+            }
+        } catch (ParseException e) {
+            throw new IllegalArgumentException("Unexpected time format : " + value + ".");

Review Comment:
   Not need to append `.` at the end of the exception message.



-- 
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 #5809: [INLONG-5808][SDK] SortSdk support parse InlongMsg

Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #5809:
URL: https://github.com/apache/inlong/pull/5809#discussion_r964340163


##########
inlong-sdk/sort-sdk/src/main/java/org/apache/inlong/sdk/sort/impl/decode/MessageDeserializer.java:
##########
@@ -48,12 +55,20 @@ public class MessageDeserializer implements Deserializer {
     private static final String INLONG_GROUPID_KEY = "inlongGroupId";
     private static final String INLONG_STREAMID_KEY = "inlongStreamId";
 
+    private static final String INLONGMSG_ATTR_STREAM_ID = "streamId";
+    private static final String INLONGMSG_ATTR_GROUP_ID = "groupId";
+    private static final String INLONGMSG_ATTR_TIME_T = "t";
+    private static final String INLONGMSG_ATTR_TIME_DT = "dt";
+    private static final String INLONG_ATTR_SOURCE_IP = "srcIp";
+    private static final char INLONGMSG_ATTR_ENTRY_DELIMITER = '&';
+    private static final char INLONGMSG_ATTR_KV_DELIMITER = '=';
+
     public MessageDeserializer() {
     }
 
     @Override
     public List<InLongMessage> deserialize(ClientContext context, InLongTopic inLongTopic, Map<String, String> headers,
-            byte[] data) throws Exception {
+                                           byte[] data) throws Exception {

Review Comment:
   It is not necessary to indent with the above parameters.



-- 
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 #5809: [INLONG-5808][SDK] SortSdk support parse InlongMsg

Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #5809:
URL: https://github.com/apache/inlong/pull/5809#discussion_r966590423


##########
inlong-sdk/sort-sdk/src/main/java/org/apache/inlong/sdk/sort/util/StringUtil.java:
##########
@@ -106,4 +245,26 @@ public static String formatDate(Date date) {
         return sdf.format(date);
     }
 
+    public static long parseDateTime(String value) {
+        try {
+            if (value.length() < 8) {

Review Comment:
   What do the 8 and 9 mean here?
   Suggested adding a comment for them.



-- 
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 #5809: [INLONG-5808][SDK] SortSdk support parse InlongMsg

Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #5809:
URL: https://github.com/apache/inlong/pull/5809#discussion_r966589833


##########
inlong-sdk/sort-sdk/src/test/java/org/apache/inlong/sdk/sort/impl/decode/MessageDeserializerTest.java:
##########
@@ -97,6 +98,9 @@ public void testDeserialize() {
 
         //5. testDeserializeVersion1CompressionType2
         testDeserializeVersion1CompressionType2();
+
+        //6. DeserializeVersion2NoCompress

Review Comment:
   One blank after `//` please.



-- 
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] vernedeng commented on a diff in pull request #5809: [INLONG-5808][SDK] SortSdk support parse InlongMsg

Posted by GitBox <gi...@apache.org>.
vernedeng commented on code in PR #5809:
URL: https://github.com/apache/inlong/pull/5809#discussion_r966669008


##########
inlong-sdk/sort-sdk/src/main/java/org/apache/inlong/sdk/sort/impl/decode/MessageDeserializer.java:
##########
@@ -144,4 +169,60 @@ private List<InLongMessage> transformMessageObjs(ClientContext context, InLongTo
         }
         return inLongMessages;
     }
+
+    private List<InLongMessage> decodeInlongMsg(
+            ClientContext context,
+            InLongTopic inLongTopic,
+            byte[] msgBytes,
+            Map<String, String> headers) {
+        List<InLongMessage> messageList = new ArrayList<>();
+
+        InLongMsg inLongMsg = InLongMsg.parseFrom(msgBytes);
+        for (String attr : inLongMsg.getAttrs()) {
+            Map<String, String> attributes = StringUtil.splitKv(attr, INLONGMSG_ATTR_ENTRY_DELIMITER,
+                    INLONGMSG_ATTR_KV_DELIMITER, null, null);
+
+            String groupId = Optional.ofNullable(attributes.get(INLONGMSG_ATTR_GROUP_ID))
+                    .orElseThrow(() -> new IllegalArgumentException("Could not find "
+                            + INLONGMSG_ATTR_GROUP_ID + " in attributes!"));
+
+            String streamId = Optional.ofNullable(attributes.get(INLONGMSG_ATTR_STREAM_ID))
+                    .orElseThrow(() -> new IllegalArgumentException("Could not find "
+                            + INLONGMSG_ATTR_STREAM_ID + " in attributes!"));
+
+            // Extracts time from the attributes
+            long msgTime;
+            if (attributes.containsKey(INLONGMSG_ATTR_TIME_T)) {
+                String date = attributes.get(INLONGMSG_ATTR_TIME_T).trim();
+                msgTime = StringUtil.parseDateTime(date);
+            } else if (attributes.containsKey(INLONGMSG_ATTR_TIME_DT)) {
+                String epoch = attributes.get(INLONGMSG_ATTR_TIME_DT).trim();
+                msgTime = Long.parseLong(epoch);
+            } else {
+                throw new IllegalArgumentException(
+                        "Could not find " + INLONGMSG_ATTR_TIME_T
+                                + " or " + INLONGMSG_ATTR_TIME_DT + " in attributes!");
+            }
+
+            String srcIp = Optional.ofNullable(attributes.get(INLONGMSG_ATTR_NODE_IP))
+                    .orElse("127.0.0.1");

Review Comment:
   fixed, thx



-- 
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] vernedeng commented on a diff in pull request #5809: [INLONG-5808][SDK] SortSdk support parse InlongMsg

Posted by GitBox <gi...@apache.org>.
vernedeng commented on code in PR #5809:
URL: https://github.com/apache/inlong/pull/5809#discussion_r966596508


##########
inlong-sdk/sort-sdk/src/test/java/org/apache/inlong/sdk/sort/impl/decode/MessageDeserializerTest.java:
##########
@@ -165,6 +169,33 @@ private void testDeserializeVersion1CompressionType2() {
         }
     }
 
+    private void testDeserializeVersion2NoCompress() {
+        try {
+            String groupId = "sort_sdk_test_group_id";
+            String streamId = "sort_sdk_test_stream_id";
+            String attr = "m=0";
+            String ip = "1.2.3.4";
+            long dt = System.currentTimeMillis();
+            StringBuilder newAttrBuffer = new StringBuilder(attr);

Review Comment:
   fixed, rename it to **_newAttrBuilder_**



-- 
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] vernedeng commented on a diff in pull request #5809: [INLONG-5808][SDK] SortSdk support parse InlongMsg

Posted by GitBox <gi...@apache.org>.
vernedeng commented on code in PR #5809:
URL: https://github.com/apache/inlong/pull/5809#discussion_r966668800


##########
inlong-sdk/sort-sdk/src/main/java/org/apache/inlong/sdk/sort/util/StringUtil.java:
##########
@@ -106,4 +245,26 @@ public static String formatDate(Date date) {
         return sdf.format(date);
     }
 
+    public static long parseDateTime(String value) {

Review Comment:
   fixed, thx



##########
inlong-sdk/sort-sdk/src/test/java/org/apache/inlong/sdk/sort/impl/decode/MessageDeserializerTest.java:
##########
@@ -97,6 +98,9 @@ public void testDeserialize() {
 
         //5. testDeserializeVersion1CompressionType2
         testDeserializeVersion1CompressionType2();
+
+        //6. DeserializeVersion2NoCompress

Review Comment:
   fixed, thx



-- 
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 #5809: [INLONG-5808][SDK] SortSdk support parse InlongMsg

Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #5809:
URL: https://github.com/apache/inlong/pull/5809#discussion_r966591565


##########
inlong-sdk/sort-sdk/src/main/java/org/apache/inlong/sdk/sort/impl/decode/MessageDeserializer.java:
##########
@@ -144,4 +169,60 @@ private List<InLongMessage> transformMessageObjs(ClientContext context, InLongTo
         }
         return inLongMessages;
     }
+
+    private List<InLongMessage> decodeInlongMsg(
+            ClientContext context,
+            InLongTopic inLongTopic,
+            byte[] msgBytes,
+            Map<String, String> headers) {
+        List<InLongMessage> messageList = new ArrayList<>();
+
+        InLongMsg inLongMsg = InLongMsg.parseFrom(msgBytes);
+        for (String attr : inLongMsg.getAttrs()) {
+            Map<String, String> attributes = StringUtil.splitKv(attr, INLONGMSG_ATTR_ENTRY_DELIMITER,
+                    INLONGMSG_ATTR_KV_DELIMITER, null, null);
+
+            String groupId = Optional.ofNullable(attributes.get(INLONGMSG_ATTR_GROUP_ID))
+                    .orElseThrow(() -> new IllegalArgumentException("Could not find "
+                            + INLONGMSG_ATTR_GROUP_ID + " in attributes!"));
+
+            String streamId = Optional.ofNullable(attributes.get(INLONGMSG_ATTR_STREAM_ID))
+                    .orElseThrow(() -> new IllegalArgumentException("Could not find "
+                            + INLONGMSG_ATTR_STREAM_ID + " in attributes!"));
+
+            // Extracts time from the attributes
+            long msgTime;
+            if (attributes.containsKey(INLONGMSG_ATTR_TIME_T)) {
+                String date = attributes.get(INLONGMSG_ATTR_TIME_T).trim();
+                msgTime = StringUtil.parseDateTime(date);
+            } else if (attributes.containsKey(INLONGMSG_ATTR_TIME_DT)) {
+                String epoch = attributes.get(INLONGMSG_ATTR_TIME_DT).trim();
+                msgTime = Long.parseLong(epoch);
+            } else {
+                throw new IllegalArgumentException(
+                        "Could not find " + INLONGMSG_ATTR_TIME_T
+                                + " or " + INLONGMSG_ATTR_TIME_DT + " in attributes!");
+            }
+
+            String srcIp = Optional.ofNullable(attributes.get(INLONGMSG_ATTR_NODE_IP))
+                    .orElse("127.0.0.1");

Review Comment:
   Suggested using a default constant for `127.0.0.1`.



-- 
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] vernedeng commented on a diff in pull request #5809: [INLONG-5808][SDK] SortSdk support parse InlongMsg

Posted by GitBox <gi...@apache.org>.
vernedeng commented on code in PR #5809:
URL: https://github.com/apache/inlong/pull/5809#discussion_r964607159


##########
inlong-sdk/sort-sdk/src/main/java/org/apache/inlong/sdk/sort/impl/decode/MessageDeserializer.java:
##########
@@ -48,12 +55,20 @@ public class MessageDeserializer implements Deserializer {
     private static final String INLONG_GROUPID_KEY = "inlongGroupId";
     private static final String INLONG_STREAMID_KEY = "inlongStreamId";
 
+    private static final String INLONGMSG_ATTR_STREAM_ID = "streamId";
+    private static final String INLONGMSG_ATTR_GROUP_ID = "groupId";
+    private static final String INLONGMSG_ATTR_TIME_T = "t";
+    private static final String INLONGMSG_ATTR_TIME_DT = "dt";
+    private static final String INLONG_ATTR_SOURCE_IP = "srcIp";
+    private static final char INLONGMSG_ATTR_ENTRY_DELIMITER = '&';
+    private static final char INLONGMSG_ATTR_KV_DELIMITER = '=';
+
     public MessageDeserializer() {
     }
 
     @Override
     public List<InLongMessage> deserialize(ClientContext context, InLongTopic inLongTopic, Map<String, String> headers,
-            byte[] data) throws Exception {
+                                           byte[] data) throws Exception {

Review Comment:
   fixed, thx



##########
inlong-sdk/sort-sdk/src/main/java/org/apache/inlong/sdk/sort/impl/decode/MessageDeserializer.java:
##########
@@ -144,4 +162,64 @@ private List<InLongMessage> transformMessageObjs(ClientContext context, InLongTo
         }
         return inLongMessages;
     }
+
+    private List<InLongMessage> decodeInlongMsg(
+            ClientContext context,
+            InLongTopic inLongTopic,
+            byte[] msgBytes,
+            Map<String, String> headers) {
+        List<InLongMessage> messageList = new ArrayList<>();
+
+        String groupId = Optional.ofNullable(headers.get(INLONGMSG_ATTR_GROUP_ID))
+                .orElseThrow(() -> new IllegalArgumentException("Could not find "
+                        + INLONGMSG_ATTR_GROUP_ID + " in attributes!"));
+
+        InLongMsg inLongMsg = InLongMsg.parseFrom(msgBytes);
+        for (String attr : inLongMsg.getAttrs()) {
+            Map<String, String> attributes = StringUtil.splitKv(attr, INLONGMSG_ATTR_ENTRY_DELIMITER,
+                    INLONGMSG_ATTR_KV_DELIMITER, null, null);
+
+            /*String groupId = Optional.ofNullable(attributes.get(INLONGMSG_ATTR_GROUP_ID))

Review Comment:
   fixed, thx



-- 
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 #5809: [INLONG-5808][SDK] SortSdk support parse InlongMsg

Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #5809:
URL: https://github.com/apache/inlong/pull/5809#discussion_r966590236


##########
inlong-sdk/sort-sdk/src/main/java/org/apache/inlong/sdk/sort/util/StringUtil.java:
##########
@@ -106,4 +245,26 @@ public static String formatDate(Date date) {
         return sdf.format(date);
     }
 
+    public static long parseDateTime(String value) {

Review Comment:
   Java doc, please.



-- 
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 #5809: [INLONG-5808][SDK] SortSdk support parse InlongMsg

Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #5809:
URL: https://github.com/apache/inlong/pull/5809#discussion_r964340372


##########
inlong-sdk/sort-sdk/src/main/java/org/apache/inlong/sdk/sort/impl/decode/MessageDeserializer.java:
##########
@@ -144,4 +162,64 @@ private List<InLongMessage> transformMessageObjs(ClientContext context, InLongTo
         }
         return inLongMessages;
     }
+
+    private List<InLongMessage> decodeInlongMsg(
+            ClientContext context,
+            InLongTopic inLongTopic,
+            byte[] msgBytes,
+            Map<String, String> headers) {
+        List<InLongMessage> messageList = new ArrayList<>();
+
+        String groupId = Optional.ofNullable(headers.get(INLONGMSG_ATTR_GROUP_ID))
+                .orElseThrow(() -> new IllegalArgumentException("Could not find "
+                        + INLONGMSG_ATTR_GROUP_ID + " in attributes!"));
+
+        InLongMsg inLongMsg = InLongMsg.parseFrom(msgBytes);
+        for (String attr : inLongMsg.getAttrs()) {
+            Map<String, String> attributes = StringUtil.splitKv(attr, INLONGMSG_ATTR_ENTRY_DELIMITER,
+                    INLONGMSG_ATTR_KV_DELIMITER, null, null);
+
+            /*String groupId = Optional.ofNullable(attributes.get(INLONGMSG_ATTR_GROUP_ID))

Review Comment:
   Suggests removing unused codes.



-- 
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 #5809: [INLONG-5808][SDK] SortSdk support parse InlongMsg

Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #5809:
URL: https://github.com/apache/inlong/pull/5809#discussion_r966589564


##########
inlong-sdk/sort-sdk/src/test/java/org/apache/inlong/sdk/sort/impl/decode/MessageDeserializerTest.java:
##########
@@ -165,6 +169,33 @@ private void testDeserializeVersion1CompressionType2() {
         }
     }
 
+    private void testDeserializeVersion2NoCompress() {
+        try {
+            String groupId = "sort_sdk_test_group_id";
+            String streamId = "sort_sdk_test_stream_id";
+            String attr = "m=0";
+            String ip = "1.2.3.4";
+            long dt = System.currentTimeMillis();
+            StringBuilder newAttrBuffer = new StringBuilder(attr);

Review Comment:
   Why name it `buffer`?



-- 
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] vernedeng commented on a diff in pull request #5809: [INLONG-5808][SDK] SortSdk support parse InlongMsg

Posted by GitBox <gi...@apache.org>.
vernedeng commented on code in PR #5809:
URL: https://github.com/apache/inlong/pull/5809#discussion_r966666802


##########
inlong-sdk/sort-sdk/src/main/java/org/apache/inlong/sdk/sort/util/StringUtil.java:
##########
@@ -106,4 +245,26 @@ public static String formatDate(Date date) {
         return sdf.format(date);
     }
 
+    public static long parseDateTime(String value) {
+        try {
+            if (value.length() < 8) {

Review Comment:
   Add the reason in the java doc, thx.



-- 
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 merged pull request #5809: [INLONG-5808][SDK] Sort SDK supports parse InlongMsg

Posted by GitBox <gi...@apache.org>.
dockerzhang merged PR #5809:
URL: https://github.com/apache/inlong/pull/5809


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