I have this dataframe:
+----+--------------------------------+
|name|dates |
+----+--------------------------------+
|A |[[1994, 12, 11], [,,]] |
|B |[[1994, 12, 11], [1994, 12, 15]]|
+----+--------------------------------+
with this schema:
root
|-- name: string (nullable = true)
|-- dates: struct (nullable = true)
| |-- start_date: struct (nullable = true)
| | |-- year: integer (nullable = true)
| | |-- month: integer (nullable = true)
| | |-- day: integer (nullable = true)
| |-- end_date: struct (nullable = true)
| | |-- year: integer (nullable = true)
| | |-- month: integer (nullable = true)
| | |-- day: integer (nullable = true)
I want to have this as output
when all fields inside end_date are null, set end date as null
+----+--------------------------------+
|name|dates |
+----+--------------------------------+
|A |[[1994, 12, 11],] |
|B |[[1994, 12, 11], [1994, 12, 15]]|
+----+--------------------------------+