val pairs = sc.parallelize(Array((1, 2), (3, 4), (5, 6), (-1, 7)))
    val shuffled = pairs.partitionBy(partitioner)
    shuffled.count

Here error, is looking forward to the results.

    val pairs = sc.parallelize(Array((1, 2), (3, 4), (5, 6), (6, 7)))
    val shuffled = pairs.partitionBy(partitioner)
    shuffled.lookup(-1)

Although the log records the error, but Spark to hang