public void checkSchemaChangeAllowed(Column other) throws DdlException {
        if (other.isGeneratedColumn()) {
            return;
        }

        if (Strings.isNullOrEmpty(other.name)) {
            throw new DdlException("Dest column name is empty");
        }

        if (!ColumnType.isSchemaChangeAllowed(type, other.type)) {
            throw new DdlException("Can not change " + getType() + " to " + other.getType());
        }

        if (this.aggregationType != other.aggregationType) {
            throw new DdlException("Can not change aggregation type");
        }

        if (this.isAllowNull && !other.isAllowNull) {
            throw new DdlException("Can not change from nullable to non-nullable");
        }

        // Adding a default value to a column without a default value is not supported
        if (!this.isSameDefaultValue(other)) {
            throw new DdlException(CAN_NOT_CHANGE_DEFAULT_VALUE);
        }

        if ((getPrimitiveType() == PrimitiveType.VARCHAR && other.getPrimitiveType() == PrimitiveType.VARCHAR)
                || (getPrimitiveType() == PrimitiveType.CHAR && other.getPrimitiveType() == PrimitiveType.VARCHAR)
                || (getPrimitiveType() == PrimitiveType.CHAR && other.getPrimitiveType() == PrimitiveType.CHAR)) {
            if (getStrLen() > other.getStrLen()) {
                throw new DdlException("Cannot shorten string length");
            }
        }
        if (getPrimitiveType().isJsonType() && other.getPrimitiveType().isCharFamily()) {
            if (other.getStrLen() <= getPrimitiveType().getTypeSize()) {
                throw new DdlException("JSON needs minimum length of " + getPrimitiveType().getTypeSize());
            }
        }
    }
@Test
    public void testSchemaChangeAllowedInvolvingDecimalv3() throws DdlException {
        Column decimalColumn =
                new Column("user", ScalarType.createDecimalV3Type(PrimitiveType.DECIMAL128, 15, 3), false, null, true,
                        new ColumnDef.DefaultValueDef(true, new StringLiteral("0")), "");

        Column varcharColumn1 = new Column("user", ScalarType.createVarchar(50), false, null, true,
                new ColumnDef.DefaultValueDef(true, new StringLiteral("0")), "");
        varcharColumn1.checkSchemaChangeAllowed(decimalColumn);
        decimalColumn.checkSchemaChangeAllowed(varcharColumn1);

        Column varcharColumn2 = new Column("user", ScalarType.createVarchar(10), false, null, true,
                new ColumnDef.DefaultValueDef(true, new StringLiteral("0")), "");
        varcharColumn2.checkSchemaChangeAllowed(decimalColumn);
        try {
            decimalColumn.checkSchemaChangeAllowed(varcharColumn2);
            Assert.fail("No exception throws");
        } catch (DdlException ex) {
        }

        Column decimalColumn2 =
                new Column("user", ScalarType.createDecimalV3Type(PrimitiveType.DECIMAL128, 20, 4), false, null, true,
                        new ColumnDef.DefaultValueDef(true, new StringLiteral("0")), "");
        decimalColumn.checkSchemaChangeAllowed(decimalColumn2);

        try {
            decimalColumn2.checkSchemaChangeAllowed(decimalColumn);
            Assert.fail("No exception throws");
        } catch (DdlException ex) {

        }

        Column decimalv2Column = new Column("user", ScalarType.createDecimalV2Type(), false, null, true,
                new ColumnDef.DefaultValueDef(true, new StringLiteral("0")), "");
        Column decimalColumn3 =
                new Column("user", ScalarType.createDecimalV3Type(PrimitiveType.DECIMAL128, 27, 9), false, null, true,
                        new ColumnDef.DefaultValueDef(true, new StringLiteral("0")), "");
        decimalv2Column.checkSchemaChangeAllowed(decimalColumn3);

        try {
            decimalColumn3.checkSchemaChangeAllowed(decimalv2Column);
            Assert.fail("No exception throws");
        } catch (DdlException ex) {

        }

        Column decimalColumn4 =
                new Column("user", ScalarType.createDecimalV3Type(PrimitiveType.DECIMAL128, 38, 13), false, null, true,
                        new ColumnDef.DefaultValueDef(true, new StringLiteral("0")), "");
        try {
            decimalv2Column.checkSchemaChangeAllowed(decimalColumn4);
            Assert.fail("No exception throws");
        } catch (DdlException ex) {

        }

        try {
            decimalColumn4.checkSchemaChangeAllowed(decimalColumn2);
            Assert.fail("No exception throws");
        } catch (DdlException ex) {

        }
    }