title: Replicate Spark Row N-times
body: <p>I want to duplicate a Row in a DataFrame, how can I do that?</p>
  
  <p>For example, I have a DataFrame consisting of 1 Row, and I want to make a DataFrame with 100 identical Rows. I came up with the following solution:</p>
  
  <pre><code>  var data:DataFrame=singleRowDF
  
     for(i&lt;-1 to 100-1) {
         data = data.unionAll(singleRowDF)
     }
  </code></pre>
  
  <p>But this introduces many transformations and it seems my subsequent actions become very slow. Is there another way to do it?</p>