I need some help with a transformation I want to make to a txt file for a homework in scala using command line of spark. Here is the array I created by using a DF:
scala> tempDF.collect()
res6: Array[org.apache.spark.sql.Row] = Array([bid|gender|department], [1|M|Informatics], [2|M|Low], [3|M|BusinessAdministration], [5|M|Mathematics], [6|M|Low], [7|M|Economics], [8|M|Economics], [9|M|Economics], [10|M|Economics], [11|M|Informatics], [13|M|Physics], [14|M|Informatics], [15|M|Informatics], [16|M|Economics], [17|M|Informatics], [18|M|Economics], [19|M|BusinessAdministration], [20|M|Mathematics], [21|M|Mathematics], [22|M|Economics], [23|M|Economics], [24|M|BusinessAdministration], [25|M|Informatics], [26|M|Statistics], [27|M|BusinessAdministration], [28|M|Economics], [29|M|Physics], [30|M|Physics], [31|M|Informatics], [32|M|Mathematics], [33|M|Economics], [34|M|BusinessAdministration], [35|M|Economics], [36|M|BusinessAdministration], [37|M|Mathema...
Now how can I transform "bid|gender|department" into columns with the following tuples like "1|M|Informatics" as the values of each column ? In the txt file, "bid|gender|department", is row 0.