private boolean checkIfColumnTypeChangeIsSupported(VoltType oldType, int oldSize,
                                                       VoltType newType, int newSize,
                                                       boolean oldInBytes, boolean newInBytes)
    {
        // increases in size are cool; shrinks not so much
        if (oldType == newType) {
            if (oldType == VoltType.STRING && oldInBytes == false && newInBytes == true) {
                // varchar CHARACTER to varchar BYTES
                return oldSize * 4 <= newSize;
            }
            return oldSize <= newSize;
        }

        // allow people to convert timestamps to longs
        // (this is useful if they accidentally put millis instead of micros in there)
        if ((oldType == VoltType.TIMESTAMP) && (newType == VoltType.BIGINT)) {
            return true;
        }

        // allow integer size increase and allow promotion to DECIMAL
        if (oldType == VoltType.BIGINT) {
            if (newType == VoltType.DECIMAL) {
                return true;
            }
        }
        // also allow lossless conversion to double from ints < mantissa size
        else if (oldType == VoltType.INTEGER) {
            if ((newType == VoltType.DECIMAL) ||
                (newType == VoltType.FLOAT) ||
                newType == VoltType.BIGINT) {
                return true;
            }
        }
        else if (oldType == VoltType.SMALLINT) {
            if ((newType == VoltType.DECIMAL) ||
                (newType == VoltType.FLOAT) ||
                (newType == VoltType.BIGINT) ||
                (newType == VoltType.INTEGER)) {
                return true;
            }
        }
        else if (oldType == VoltType.TINYINT) {
            if ((newType == VoltType.DECIMAL) ||
                (newType == VoltType.FLOAT) ||
                (newType == VoltType.BIGINT) ||
                (newType == VoltType.INTEGER) ||
                (newType == VoltType.SMALLINT)) {
                return true;
            }
        }
        return false;
    }
private boolean checkIfColumnTypeChangeIsSupported ( VoltType oldType , int oldSize , VoltType newType , int newSize , boolean oldInBytes , boolean newInBytes ) { if ( oldType == newType ) { if ( oldType == VoltType . STRING && oldInBytes == false && newInBytes == true ) { return oldSize * 4 <= newSize ; } return oldSize <= newSize ; } if ( ( oldType == VoltType . TIMESTAMP ) && ( newType == VoltType . BIGINT ) ) { return true ; } if ( oldType == VoltType . BIGINT ) { if ( newType == VoltType . DECIMAL ) { return true ; } } else if ( oldType == VoltType . INTEGER ) { if ( ( newType == VoltType . DECIMAL ) || ( newType == VoltType . FLOAT ) || newType == VoltType . BIGINT ) { return true ; } } else if ( oldType == VoltType . SMALLINT ) { if ( ( newType == VoltType . DECIMAL ) || ( newType == VoltType . FLOAT ) || ( newType == VoltType . BIGINT ) || ( newType == VoltType . INTEGER ) ) { return true ; } } else if ( oldType == VoltType . TINYINT ) { if ( ( newType == VoltType . DECIMAL ) || ( newType == VoltType . FLOAT ) || ( newType == VoltType . BIGINT ) || ( newType == VoltType . INTEGER ) || ( newType == VoltType . SMALLINT ) ) { return true ; } } return false ; }
@param oldType The old type of the column.
@param oldSize The old size of the column.
@param newType The new type of the column.
@param newSize The new size of the column.

@return True if the change from one column type to another is possible
to do live without failing or truncating any data.