GayathriSrividya opened a new pull request, #3524:
URL: https://github.com/apache/iceberg-python/pull/3524
closes #3105
## Summary
- Fix upsert row-matching when source schema has newly-added non-key columns
after schema evolution.
- Avoid casting the entire source table to the target schema in upsert row
comparison.
- Add a regression test for upsert after add_column evolution.
## Root cause
get_rows_to_update cast the full source table to the matched target batch
schema before joining. When source contains a newly-added column, target scan
batches may not include that column, causing schema-name mismatch errors.
## Changes
- In pyiceberg/table/upsert_util.py:
- Cast only join columns to target join-column schema.
- Keep join key order stable by using join_cols directly.
- Treat missing non-key columns in target rows as None during comparison.
- In tests/table/test_upsert.py:
- Add test_upsert_after_schema_add_column regression test.
## Validation
- make lint
- /Users/gayathrir/Documents/airforce/iceberg-python/.venv/bin/python -m
build
- /Users/gayathrir/Documents/airforce/iceberg-python/.venv/bin/python -m
pytest tests/table/test_upsert.py -xvs
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]