Python Exit While Loop When Condition In Pyspark Sqlcontext