[SPARK-1817] Throwing SparkException instead