How to apply fill only when the col is missing
#1336
|
How to apply the df.convertTo<MyData>{
fill{col("NewCol")}.with{"default"}
}
Currently, I faced the situation like this, we updated the Data Schema and add some new columns. Some users use the new schema fields in the CSV file, and other not update and still used the old schema which lacked the new col here. The Is possible to only apply the |
Replies: 1 comment
|
Good question! This is indeed something missing in the API. It looks like we need a In the meantime, a workaround could be: df.convertTo<MyData> {
if (!df.containsColumn("NewCol")) fill { "NewCol"() }.with { "default" }
} |
Good question! This is indeed something missing in the API. It looks like we need a
fillWhenMissing {}or something like that.In the meantime, a workaround could be: