I have created the below data frame from an rdd using reducebyKey. I want to split the first column (originally the key) into 2 new columns which are split by the comma.
scala> result_winr_table.schema
res10: org.apache.spark.sql.types.StructType = StructType(StructField(_1,StructType(StructField(_1,IntegerType,false), StructField(_2,IntegerType,false)),true), StructField(_2,DoubleType,false))
scala> result_winr_table
res5: org.apache.spark.sql.DataFrame = [_1: struct<_1:int,_2:int>, _2: double]
scala> result_winr_table.show
+--------+-------------------+
| _1| _2|
+--------+-------------------+
| [31,88]| 0.475|
| [18,91]| 0.5833333333333334|
| [56,95]|0.37142857142857144|
| [70,61]| 0.6266666666666667|
|[104,11]| 0.4527911784975879|
| [42,58]| 0.6857142857142857|
| [13,82]| 0.3333333333333333|
| [30,18]|0.49310344827586206|
| [99,18]|0.44285714285714284|
| [53,31]| 0.2981366459627329|
| [52,84]| 0.4444444444444444|
| [60,38]| 0.38|
| [79,9]|0.36666666666666664|
| [20,85]| 0.4389312977099237|
| [61,87]| 0.4807692307692308|
| [3,67]| 0.4245810055865922|
| [62,84]|0.47796610169491527|
| [9,32]| 0.4727272727272727|
| [94,44]| 0.5698324022346368|
| [50,67]|0.45083487940630795|
+--------+-------------------+
I tried using split method on the column directly but it didnt work because of a type mis-match.
What would be the best way to achieve this?