Ok, figured out the issue out - SparkPi tries to add a jar from env variable 'SPARK_EXAMPLES_JAR'.
Which need not (or wont) be set when running in yarn mode (we have to use the --jar option).

So the code snippet from SparkPi :
--
    val spark = new SparkContext(args(0), "SparkPi",
      System.getenv("SPARK_HOME"), Seq(System.getenv("SPARK_EXAMPLES_JAR")))

-- 

will cause jars seq to have a null within it : hence the addJar null check is required and solves the issue.