eldenmoon commented on code in PR #17651:
URL: https://github.com/apache/doris/pull/17651#discussion_r1132040024


##########
fe/fe-core/src/main/java/org/apache/doris/analysis/LiteralExpr.java:
##########
@@ -334,41 +335,36 @@ public static int getParmLen(ByteBuffer data) {
             return 0;
         }
         // get and advance 1 byte
-        int len = data.get();
-        if (len < 251) {
-            return len;
-        }
-        if (maxLen < 3) {
-            return 0;
-        }
+        int len = MysqlProto.readInt1(data);
         if (len == 252) {
+            if (maxLen < 3) {
+                return 0;
+            }
             // get and advance 2 bytes
-            return data.getChar();
-        }
-        if (maxLen < 4) {
-            return 0;
-        }
-        if (len == 253) {
+            return MysqlProto.readInt2(data);
+        } else if (len == 253) {
+            if (maxLen < 4) {
+                return 0;
+            }
             // get and advance 3 bytes
-            byte[] bytes = new byte[3];
-            data.get(bytes);
-            return ByteBuffer.wrap(bytes).getInt();
-        }
-        if (maxLen < 5) {
+            return MysqlProto.readInt3(data);
+        } else if (len == 254) {
+            /*
+            In our client-server protocol all numbers bigger than 2^24
+            stored as 8 bytes with uint8korr. Here we always know that
+            parameter length is less than 2^4 so we don't look at the second
+            4 bytes. But still we need to obey the protocol hence 9 in the
+            assignment below.
+            */
+            if (maxLen < 5) {
+                return 0;
+            }
+            return MysqlProto.readInt4(data);

Review Comment:
   is it enough to just read 4 bytes? but mysql protocol consists of 8 bytes 
when len = 254



-- 
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-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to