title: passing UDF to a method or class
body: <p>I have a UDF say</p>
  
  <pre><code>val testUDF = udf{s: string=&gt;s.toUpperCase}
  </code></pre>
  
  <p>I want to create this UDF in a separate method or may be something else like an implementation class and pass it on another class which uses it. Is it possible?</p>
  
  <p>Say suppose I have a class A</p>
  
  <pre><code>class A(df: DataFrame) {
      def testMethod(): DataFrame = {
          val demo=df.select(testUDF(col))
      }
  }
  </code></pre>
  
  <p>class A should be able to use UDF. Can this be achieved?</p>