manuzhang opened a new pull request, #18255: URL: https://github.com/apache/iceberg/pull/18255
### Problem Renaming a qualified view to an unqualified target moves the view into the session's current namespace instead of keeping it in the source view's namespace. ```sql USE catalog.other_ns; ALTER VIEW source_ns.v RENAME TO v2; -- v2 lands in other_ns, not source_ns ``` ### Root cause `ExtendedDataSourceV2Strategy` resolves the rename target with `Spark3Util.catalogAndIdentifier` before deciding whether the target is actually unqualified. For a single-part target name that helper fills in the current namespace, so the identifier handed to `IcebergRenameV2ViewExec` already carries the session namespace. `IcebergRenameV2ViewExec` does handle an unqualified target correctly — it fills the namespace in from the source view — but that branch is unreachable because the namespace is never empty by the time it runs. ### Changes - Resolve single-part rename targets with an empty namespace, letting `IcebergRenameV2ViewExec` apply the source view's namespace. This matches Spark's v2 [`RenameTableExec`](https://github.com/apache/spark/blob/branch-4.1/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/RenameTableExec.scala#L46-L50). - Resolve multi-part targets relative to the source catalog, keeping the existing cross-catalog move rejection. - Add a regression test covering a qualified source view renamed to an unqualified target while the session is using another namespace. ### Tests The new test fails on `main` for all three catalog configurations and passes with the fix. `TestViews` runs 294 tests with no failures. --- **AI Disclosure** - Model: Claude Opus 5 - Platform/Tool: Claude Code - Human Oversight: partially reviewed - Prompt Summary: port the Spark 4.1 view rename namespace fix to Spark 4.2, with a regression test. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
