RANK, NTILE etc. functions should not always return INTEGER. For example, RANK() and PERCENT_RANK() both return INTEGER. For RANK(), it would be better to return BIGINT; for PERCENT_RANK(), we should actually return DOUBLE or FLOAT since it is a percent value. There are other rank functions that should return floating number instead of INTEGER.