AMashenkov commented on code in PR #2964:
URL: https://github.com/apache/ignite-3/pull/2964#discussion_r1432806711


##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/commands/CatalogUtils.java:
##########
@@ -215,39 +221,47 @@ static boolean validateColumnChange(
             @Nullable Integer newLength,
             TypeChangeValidationListener listener
     ) {
-        if (newType != null && newType != origin.type()) {
-            if (!isSupportedColumnTypeChange(origin.type(), newType)) {
+        if (newType != null) {
+            if (isSupportedColumnTypeChange(origin.type(), newType)) {
+                if (origin.type().precisionAllowed() && newPrecision != null 
&& newPrecision < origin.precision()) {
+                    listener.onFailure("Decreasing the precision for column of 
type '{}' is not allowed", origin.type(), newType);
+                    return false;
+                }
+
+                if (origin.type().scaleAllowed() && newScale != null && 
newScale != origin.scale()) {
+                    listener.onFailure("Changing the scale for column of type 
'{}' is not allowed", origin.type(), newType);
+                    return false;
+                }
+
+                if (origin.type().lengthAllowed() && newLength != null && 
newLength < origin.length()) {
+                    listener.onFailure("Decreasing the length for column of 
type '{}' is not allowed", origin.type(), newType);
+                    return false;
+                }
+
+                return true;
+            }
+
+            if (newType != origin.type()) {

Review Comment:
   Seems, this is always true.



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