code: public int getPartition(K key, V value,
                            int numReduceTasks) {
      return (key.hashCode() & Integer.MAX_VALUE) % numReduceTasks;
    }
docs: Use {@link Object#hashCode()} to partition.