presto-tpch/src/main/java/io/prestosql/plugin/tpch/TpchBucketFunction.java/TpchBucketFunction/getBucket
class TpchBucketFunction:    @Override
    public int getBucket(Page page, int position)
    {
        Block block = page.getBlock(0);
        if (block.isNull(position)) {
            return 0;
        }

        long orderKey = BIGINT.getLong(block, position);
        long rowNumber = rowNumberFromOrderKey(orderKey);
        int bucket = toIntExact(rowNumber / rowsPerBucket);

        // due to rounding, the last bucket has extra rows
        if (bucket >= bucketCount) {
            bucket = bucketCount - 1;
        }
        return bucket;
    }