private static int getLength()

in fluss-common/src/main/java/com/alibaba/fluss/row/indexed/IndexedRow.java [271:308]


    private static int getLength(DataType dataType) {
        switch (dataType.getTypeRoot()) {
            case BOOLEAN:
            case TINYINT:
                return 1;
            case SMALLINT:
                return 2;
            case INTEGER:
            case FLOAT:
            case DATE:
            case TIME_WITHOUT_TIME_ZONE:
                return 4;
            case BIGINT:
            case DOUBLE:
            case DECIMAL:
                return 8;
            case TIMESTAMP_WITHOUT_TIME_ZONE:
                final int timestampNtzPrecision = getPrecision(dataType);
                if (TimestampNtz.isCompact(timestampNtzPrecision)) {
                    return 8;
                } else {
                    return 12;
                }
            case TIMESTAMP_WITH_LOCAL_TIME_ZONE:
                final int timestampLtzPrecision = getPrecision(dataType);
                if (TimestampLtz.isCompact(timestampLtzPrecision)) {
                    return 8;
                } else {
                    return 12;
                }
            case CHAR:
                return ((CharType) dataType).getLength();
            case BINARY:
                return ((BinaryType) dataType).getLength();
            default:
                throw new IllegalArgumentException(" Data type '%s' is not fixed length type!");
        }
    }