sparksql: only define functions if pyspark is defined