Suppose I have a Spark Scala DataFrame object like:
+----------------+
|col1 |col2 |
+----------------+
|1 |2 |
|3 |4 |
+----------------+
And I want a DataFrame like:
+--------------------+
|col1 |col2 |col3 |
+--------------------+
|1 |2 |3 |
|3 |4 |7 |
+--------------------+
Which adds col1
and col2
to col3
, could anyone please tell me how to do that? WithColumn
takes only one column as parameter whereas I need to take two columns.