title: How to unpivot the table based on the multiple columns
body: <p>I am using Scala and Spark to <em>unpivot</em> a table which looks like as below: </p>
  
  <pre><code>+---+----------+--------+-------+------+-----+
  | ID|   Date   |  Type1 | Type2 | 0:30 | 1:00|
  +---+----------+--------+-------+------+-----+
  |  G| 12/3/2018|  Import|Voltage| 3.5  | 6.8 |
  |  H| 13/3/2018|  Import|Voltage| 7.5  | 9.8 |
  |  H| 13/3/2018|  Export|   Watt| 4.5  | 8.9 |
  |  H| 13/3/2018|  Export|Voltage| 5.6  | 9.1 |
  +---+----------+--------+-------+------+-----+
  </code></pre>
  
  <p>I want to transpose it as follow: </p>
  
  <pre><code>| ID|Date     | Time|Import-Voltage |Export-Votage|Import-Watt|Export-Watt|
  
  |  G|12/3/2018|0:30 |3.5            |0            |0          |0          |
  |  G|12/3/2018|1:00 |6.8            |0            |0          |0          |
  |  H|13/3/2018|0:30 |7.5            |5.6          |0          |4.5        |
  |  H|13/3/2018|1:00 |9.8            |9.1          |0          |8.9        |
  </code></pre>
  
  <p>And <code>Time</code> and <code>Date</code> columns should be also merged like</p>
  
  <pre><code>12/3/2018 0:30
  </code></pre>