scala - UDF in Spark being called twice -
i running problem udf being called twice. first sql command tried running is:
sqlcontext.sql("select * ( select city, ctof(avglow) feren citytemps ) x feren > 30.0 order feren desc").show();
where ctof udf.
i noticed ctof being called twice here (i suspect in clause , again in select clause). added print statements inside ctof function , saw ferenheit calculation above 30 degrees , ctof called twice. i'd rather called once since have extremely large dataframe.
after didn't have luck sql command, tried following:
val ferendf = sqlcontext.sql("select city, ctof(avglow) feren citytemps"); ferendf.registertemptable("ferentemp"); sqlcontext.sql("select city, feren ferentemp feren > 30.0 order feren desc").show();
my udf, ctof, still being called twice. there anyway can run these sql commands ctof being called once? fyi, using spark 2.1.0.
Comments
Post a Comment