title: Spark SQL convert dataset to dataframe
body: <p>How do I convert a dataset obj to a dataframe?  In my example, I am converting a JSON file to dataframe and converting to DataSet.  In dataset, I have added some additional attribute(<code>newColumn</code>) and convert it back to a dataframe. Here is my example code:</p>
  
  <pre><code>val empData = sparkSession.read.option("header", "true").option("inferSchema", "true").option("multiline", "true").json(filePath)
  </code></pre>
  
  <p>.....</p>
  
  <pre><code> import sparkSession.implicits._
      val res = empData.as[Emp]
  
      //for (i &lt;- res.take(4)) println(i.name + " -&gt;" + i.newColumn)
  
      val s = res.toDF();
  
      s.printSchema()
  
    }
    case class Emp(name: String, gender: String, company: String, address: String) {
      val newColumn = if (gender == "male") "Not-allowed" else "Allowed"
    }
  </code></pre>
  
  <p>But I am expected the new column name <code>newColumn</code> added in <code>s.printschema()</code>. output result.  But it is not happening?  Why?  Any reason?  How can I achieve this?</p>