You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "manuzhang (via GitHub)" <gi...@apache.org> on 2026/09/25 02:17:17 UTC
[PR] Spark 4.2: Fix view rename target namespace [iceberg]
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Spark 4.2: Fix view rename target namespace [iceberg]
Posted by "szehon-ho (via GitHub)" <gi...@apache.org>.
szehon-ho commented on PR #18255:
URL: https://github.com/apache/iceberg/pull/18255#issuecomment-6051179502
@manuzhang can you retrigger it?
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Spark 4.2: Fix view rename target namespace [iceberg]
Posted by "szehon-ho (via GitHub)" <gi...@apache.org>.
szehon-ho commented on PR #18255:
URL: https://github.com/apache/iceberg/pull/18255#issuecomment-5961752357
can you double check ci failures?
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Spark 4.2: Fix view rename target namespace [iceberg]
Posted by "szehon-ho (via GitHub)" <gi...@apache.org>.
szehon-ho merged PR #18255:
URL: https://github.com/apache/iceberg/pull/18255
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Spark 4.2: Fix view rename target namespace [iceberg]
Posted by "szehon-ho (via GitHub)" <gi...@apache.org>.
szehon-ho commented on code in PR #18255:
URL: https://github.com/apache/iceberg/pull/18255#discussion_r4160835866
##########
spark/v4.2/spark-extensions/src/main/scala/org/apache/spark/sql/execution/datasources/v2/ExtendedDataSourceV2Strategy.scala:
##########
@@ -189,6 +185,24 @@ case class ExtendedDataSourceV2Strategy(spark: SparkSession) extends Strategy wi
case _ => Nil
}
+ private def resolveViewRenameTarget(
+ sourceCatalog: ViewCatalog,
+ targetName: Seq[String]): Identifier = {
+ if (targetName.length == 1) {
+ // An unqualified target renames in place, matching Spark's v2 RenameTableExec. Resolving it
Review Comment:
I'd remove the bug explanation here, as it doesnt seem relevant? Or keep it minuimalistic, like why mention Spark3Util if not used.
Also do we need to add some info to the Spark3Util javadoc (if it makes sense)? It seems a better place if needed.
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Spark 4.2: Fix view rename target namespace [iceberg]
Posted by "szehon-ho (via GitHub)" <gi...@apache.org>.
szehon-ho commented on PR #18255:
URL: https://github.com/apache/iceberg/pull/18255#issuecomment-6072445020
Merged, thanks @manuzhang
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org