spark = SparkSession.builder.master('local').appName('tow-way') .config('spark.sql.codegen.wholeStage', 'false') ## <-- add this line .getOrCreate()