title: How to create dynamic column in Spark dataframe?
body: <p>Reading a book on Spark. I can create a Dataframe/Dataset of single column with multiple rows as follows</p>
  
  <pre><code>val df = spark.range(10).toDF
  df.count             #=&gt; 10
  df.printSchema       #=&gt; id: long (nullable = false)
  </code></pre>
  
  <p>Is there a way to dynamically create Dataframe/Dataset having multiple columns?</p>
  
  <p>What I am trying to do is to create a dataframe with thousands of columns. So looking for ways to create them dynamically.</p>