I've been trying to update the nested field value in a Pyspark DataFrame. I followed the answer given at How to update a value in the nested column of struct using pyspark but it is not till the level I want.
json data  
{
  "documentKey": {
    "_id": "1234567"
  },
    "fullDocument": {
        "did": "1fcee68a43c500e0",
        "sg": {
            "media_ended_timestamp": 1626940125,
            "media_id": 56010
        },
        "ts": "ts"
  }
}
Now, let's say I want to update the field fullDocument.sg.media_id to 11111 from 56010. What could be the possible way to do so?
Note: With the answer mentioned in the link I pasted above, I was able to update fullDocument.did successfully.
spark: 3.1.1 python: 3.9