title: Calling other methods/variables inside a UDF method in Spark SQL DataFrame
body: <p>I have a Spark SQL DF, in which i am trying to call one UDF [ which i created using Spark SQL <code>udf</code>.</p>
  
  <pre><code>val udfName = udf(somemethodName)
  val newDF = df.withColumn("columnnew", udfName(col("anotherDFColumn"))
  </code></pre>
  
  <p>I'm trying to use another DF stored as a <code>val</code> inside the somemethodName, but the DF is coming as null.</p>
  
  <p>This is happening only when i use where clause in the <code>newDF</code>.</p>
  
  <p>Am i missing something?Is it not possible to use another variable / method inside UDF method?</p>
  
  <p>Or do i have to do something with broadcast? Currently i am running this on local, not in the cluster though.</p>