title: Spark convert rdd to dataframe using a class
body: <p>I'm using Spark 1.6 with Scala.
  i was looking <a href="https://stackoverflow.com/questions/29383578/how-to-convert-rdd-object-to-dataframe-in-spark">here</a> but i didnt find a clear answer 
  I have a big file, after filtering the first lines that contain some copyrights I want to take the header (104 fields) and convert it to <code>StructType</code> schema.
  I was thinking to use a class extends <code>Product</code> trait to define the schema of the <code>Dataframe</code> and then convert it to <code>Dataframe</code> according to that schema.</p>
  
  <p>What is the best way to do it. </p>
  
  <p>This is a sample from my file:</p>
  
  <pre><code>   text  (06.07.03.216)  COPYRIGHT © skdjh 2000-2016
      text  160614_54554.vf Database    53643_csc   Interface   574 zn  65
      Start   Date    14/06/2016  00:00:00:000
      End Date    14/06/2016  00:14:59:999
      State   "s23"
  
          cin. Nb      Start     End        Event       Con. Duration  IMSI
          32055680    16/09/2010 16:59:59:245 16/09/2016 17:00:00:000 xxxxxxxxxxxxx
          32055680    16/09/2010 16:59:59:245 16/09/2016 17:00:00:000 xxxxxxxxxxxxx
          32055680    16/09/2010 16:59:59:245 16/09/2016 17:00:00:000 xxxxxxxxxxxxx
          32055680    16/09/2010 16:59:59:245 16/09/2016 17:00:00:000 xxxxxxxxxxxxx
          32055680    16/09/2010 16:59:59:245 16/09/2016 17:00:00:000 xxxxxxxxxxxxx
  </code></pre>
  
  <p>T want to convert it to SparkSQL like this schema</p>
  
  <pre><code>    ----------------------------------------------------------------------------------------
    |    cin_Nb |  Start            |   End          |      Event   |   Con_Duration  | IMSI  |
    | ----------------------------------------------------------------------------------------|
    |   32055680 |   16/09/2010     |   16:59:59:245 |  16/09/2016  |   17:00:00:000  | xxxxx |
    |   32055680 |   16/09/2010     |   16:59:59:245 |  16/09/2016  |   17:00:00:000  | xxxxx |
    |   32055680 |   16/09/2010     |   16:59:59:245 |  16/09/2016  |   17:00:00:000  | xxxxx |
    |   20556800 |   16/09/2010     |   16:59:59:245 |  16/09/2016  |   17:00:00:000  | xxxxx |
    |   32055680 |   16/09/2010     |   16:59:59:245 |  16/09/2016  |   17:00:00:000  | xxxxx | 
      ----------------------------------------------------------------------------------------
  </code></pre>