jonvex commented on code in PR #13711:
URL: https://github.com/apache/hudi/pull/13711#discussion_r2353730435


##########
hudi-common/src/main/java/org/apache/hudi/internal/schema/utils/SchemaChangeUtils.java:
##########
@@ -72,38 +72,59 @@ private static boolean isTypeUpdateAllowInternal(Type src, 
Type dsr) {
     switch (src.typeId()) {
       case INT:
         return dsr == Types.LongType.get() || dsr == Types.FloatType.get()
-            || dsr == Types.DoubleType.get() || dsr == Types.StringType.get() 
|| dsr.typeId() == Type.TypeID.DECIMAL;
+            || dsr == Types.DoubleType.get() || dsr == Types.StringType.get() 
|| dsr.typeId() == Type.TypeID.DECIMAL || dsr.typeId() == 
Type.TypeID.DECIMAL_FIXED;
       case LONG:
-        return dsr == Types.FloatType.get() || dsr == Types.DoubleType.get() 
|| dsr == Types.StringType.get() || dsr.typeId() == Type.TypeID.DECIMAL;
+        return dsr == Types.FloatType.get() || dsr == Types.DoubleType.get() 
|| dsr == Types.StringType.get() || dsr.typeId() == Type.TypeID.DECIMAL || 
dsr.typeId() == Type.TypeID.DECIMAL_FIXED;
       case FLOAT:
-        return dsr == Types.DoubleType.get() || dsr == Types.StringType.get() 
|| dsr.typeId() == Type.TypeID.DECIMAL;
+        return dsr == Types.DoubleType.get() || dsr == Types.StringType.get() 
|| dsr.typeId() == Type.TypeID.DECIMAL || dsr.typeId() == 
Type.TypeID.DECIMAL_FIXED;
       case DOUBLE:
-        return dsr == Types.StringType.get() || dsr.typeId() == 
Type.TypeID.DECIMAL;
+        return dsr == Types.StringType.get() || dsr.typeId() == 
Type.TypeID.DECIMAL || dsr.typeId() == Type.TypeID.DECIMAL_FIXED;
       case DATE:
       case BINARY:
         return dsr == Types.StringType.get();
+      case DECIMAL_BYTES:
+        return isDecimalBytesUpdateAllowInternal(src, dsr);
       case DECIMAL:
-        if (dsr.typeId() == Type.TypeID.DECIMAL) {
-          Types.DecimalType decimalSrc = (Types.DecimalType)src;
-          Types.DecimalType decimalDsr = (Types.DecimalType)dsr;
-          if (decimalDsr.isWiderThan(decimalSrc)) {
-            return true;
-          }
-          if (decimalDsr.precision() >= decimalSrc.precision() && 
decimalDsr.scale() == decimalSrc.scale()) {
-            return true;
-          }
-        } else if (dsr.typeId() == Type.TypeID.STRING) {
-          return true;
-        }
-        break;
+      case DECIMAL_FIXED:
+        return isDecimalFixedUpdateAllowInternal(src, dsr);
       case STRING:
-        return dsr == Types.DateType.get() || dsr.typeId() == 
Type.TypeID.DECIMAL || dsr == Types.BinaryType.get();
+        return dsr == Types.DateType.get() || dsr.typeId() == 
Type.TypeID.DECIMAL || dsr.typeId() == Type.TypeID.DECIMAL_FIXED || dsr == 
Types.BinaryType.get();
       default:
         return false;
     }
+  }
+
+  private static boolean isDecimalBytesUpdateAllowInternal(Type src, Type dsr) 
{

Review Comment:
   oh lol, that's totally what that is. I used dsr because that is what the 
above method did.



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

Reply via email to