I have a Spark Scala dataframe with a nested structure:
|-- _History: struct (nullable = true)
| |-- Article: array (nullable = true)
| | |-- element: struct (containsNull = true)
| | | |-- Id: string (nullable = true)
| | | |-- Timestamp: long (nullable = true)
| |-- Channel: struct (nullable = true)
| | |-- <font><font>Cultura pop</font></font>: array (nullable = true)
| | | |-- element: long (containsNull = true)
| | |-- <font><font>Deportes</font></font>: array (nullable = true)
| | | |-- element: long (containsNull = true)
I'm trying to rename the nested elements (e.g. <font><font>Deportes</font></font>
to Deportes
. Is there a way to do this using a UDF or something similar?
I've tried the following, which doesn't work:
var filterDF2 = filterDF
.withColumnRenamed("_History.Channel.<font><font>Deportes</font></font>", "_History.Channel.Deportes")