title: Best way to read logic from JSON file and apply specific logic using spark scala
body: <p>I have an initial data frame that is created by reading a <code>JSON</code> file. Now I have <code>config</code> like below:  </p>
  
  <pre><code>{
  "sourceField":"id",
  "transformLogic":"where id&gt;=10"
  "targetField":"patientId"
  }  
  </code></pre>
  
  <p>So, what I did is I read this config file, took first value of "<code>transformLogic</code>" field, and using spark SQL I generated the query and executed it against the initial JSON data frame. However, I am not satisfied with that because the string of <code>transformLogic</code> is hardcoded by me and it should be dynamic. Its something like read the config file, apply the specific logic against the <code>sourceField</code> and it should be reflected in the target field in the transformed data frame. How can I make it dynamic that would use <code>sourceField</code> and <code>targetField</code></p>
  
  <p>I need some suggestions to implement this approach. I can take care of the coding part. I hope I am clear enough to explain my problem.</p>