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

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -