title: How to access broadcast variable from a udf and broadcast variable is defined in another class where this udf is being called
body: <p><strong>How to access the broadcast variable from a UDF and broadcast variable is defined in another class where this UDF is being called</strong>. </p>
  
  <pre><code>    /* this udf is in different file */
      package com.abc
       public class JavaClass{
          public static UserDefinedFunction getvalue = udf((String param) -&gt; {
  
          return "String value";
          }, DataTypes.StringType);
  
      }    
  **/* below code is in different file */** 
      package com.xyz;
      import com.abc.JavaClass;
       public class AnotherClassToCallUDF{
          pubic static void main(String args[]) {
      Dataset&lt;Row&gt; abc = .......;
  
      abc.withColoumn("new-col",JavaClass.getvalue.apply("passing some value"));
      }
  
      }       
  
      **/* in the above code , how to pass broadcast variable while calling udf...since udf accepts only col typ`enter code here`e and lit type ..it does not accept anything else..then how to access broadcast variable which is defined in main class and accessing in another class..       
  */**
  </code></pre>