HappenLee commented on code in PR #18277:
URL: https://github.com/apache/doris/pull/18277#discussion_r1155455320


##########
fe/fe-core/src/main/java/org/apache/doris/mysql/MysqlSerializer.java:
##########
@@ -253,17 +255,53 @@ private int getMysqlTypeLength(PrimitiveType type) {
                 return 10;
             case DATETIME:
             case DATETIMEV2: {
-                if (type.isTimeType()) {
+                if (type.getPrimitiveType().isTimeType()) {
                     return 10;
-                }  else {
+                } else {
                     return 19;
                 }
             }
+            case DECIMALV2:
+            case DECIMAL32:
+            case DECIMAL64:
+            case DECIMAL128: {
+                // f.getDecimals() > 0 ? clampedGetLength(f) - 1 + 
f.getPrecisionAdjustFactor() :
+                // clampedGetLength(f) + f.getPrecisionAdjustFactor();
+                ScalarType decimalType = (ScalarType) type;
+                int precision = decimalType.decimalPrecision();
+                int scale = decimalType.decimalScale();
+                if (scale > 0) {
+                    precision += 2;
+                } else {

Review Comment:
   why scale == 0 need +=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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to