Open johanl-db opened 5 months ago
Hello @johanl-db, Could you please assign this issue to me? I am confident I can help resolve it and would appreciate any guidance as needed.
@Richard-code-gig thanks for volunteering for this. I would start by adding a test in e.g. deltaInsertIntoSuite to cover the problematic case and work from there.
I believe this only impacts INSERT by position:
INSERT INTO <table> VALUES (...)
or `INSERT INTO
Bug
Describe the problem
Schema evolution in INSERT doesn't always work properly when the new column is added to a struct nested within an array or map. If another column is renamed, the operation fails when it should succeed.
Steps to reproduce
For example with a map, in python, renaming column
key
torenamed_key
and added a fieldcomment
in the a struct inside the map:Note that the struct inside the map isn't evolved to add the new field. Without the unrelated column being renamed, this works well:
Observed results
The operation fails.
Expected results
The operation succeeds, the table schema is changed to
key int, metrics map<string, struct<id: int, value: int, comment: string>>
and the data is inserted.Willingness to contribute
The Delta Lake Community encourages bug fix contributions. Would you or another member of your organization be willing to contribute a fix for this bug to the Delta Lake code base?