Sanjays2402 opened a new pull request, #3687:
URL: https://github.com/apache/iceberg-python/pull/3687
Closes #2599.
## What
`rename_column` stages the new column name in `self._updates`, but
`move_first`/`move_before`/`move_after` resolved the target column via
`self._schema.find_field(...)` against the **original** schema. Moving a column
by its **new** name within the same update context therefore raised
`ValueError: Cannot move missing column`.
## Reproduction
```python
with tbl.update_schema() as update:
update.rename_column("some_column", "renamed_column")
update.move_first("renamed_column") # ValueError: Cannot move missing
column: renamed_column
```
The reporter hit this via AWS Glue, but it reproduces fully in-memory with
`InMemoryCatalog` — it is not Glue-specific.
## Fix
`_find_for_move` now checks staged renames in `self._updates` first
(respecting `_case_sensitive`) before falling back to the original schema,
matching the Java implementation which resolves staged renames.
## Tests
Added `tests/table/test_update_schema.py` covering rename-then-move by new
name for `move_first`, `move_before`, and `move_after`. Without the fix all 3
fail with `ValueError: Cannot move missing column`; with the fix all 3 pass.
`ruff check` and `ruff format --check` clean.
--
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]