我有一个结构作为我的json的一部分。
store: struct (c1, c2, c3, c4)
我想c2就地更新,这样就不会创建新字段。更新后,它应该是具有新值的相同结构c2。
在Spark/scala中,我已经尝试过:
df.withColumn("store.c2", newVal)
Run Code Online (Sandbox Code Playgroud)
但这会创建一个新字段store.c2,列不是结构的一部分,我可以更新。
df.withColumn("columnTen", newValue)
Run Code Online (Sandbox Code Playgroud)
不创建新字段并更新为newValue.