sahmadov opened a new pull request, #16029: URL: https://github.com/apache/iceberg/pull/16029
## Summary
- `RewriteViewCommands` only checked `catalog.isInstanceOf[ViewCatalog]`
before rewriting `SHOW VIEWS` / `CREATE VIEW` / `DROP VIEW` into
Iceberg-specific plans (`ShowIcebergViews`, `CreateIcebergView`,
`DropIcebergView`). Any non-Iceberg catalog that also implements Spark's
`ViewCatalog` interface — for example,
a subclass of Spark's `JDBCTableCatalog` that additionally implements
`ViewCatalog` to provide JDBC-backed views — was therefore incorrectly
intercepted once `IcebergSparkSessionExtensions` was loaded, and the rewritten
plan failed because the catalog isn't backed by an Iceberg view implementation.
- `ViewUtil.isViewCatalog` now also requires `HasIcebergCatalog`. All
Iceberg-provided Spark catalogs (`SparkCatalog`, `SparkSessionCatalog`) already
implement it via `BaseCatalog`, so there's no behavior change for them.
Non-Iceberg `ViewCatalog`s now fall through to Spark's default view handling.
- Applied to `spark-extensions` for v3.4, v3.5, v4.0, and v4.1.
Example that triggered the bug:
```scala
class IometeJDBCTableCatalog extends JDBCTableCatalog with ViewCatalog
```
### Test plan
- New TestViewUtil (one per Spark version) asserts:
- ViewCatalog without HasIcebergCatalog → isViewCatalog is false
- ViewCatalog with HasIcebergCatalog → isViewCatalog is true
- non-ViewCatalog CatalogPlugin → isViewCatalog is false
- Existing TestViews continues to pass — Iceberg view catalogs are still
detected.
### AI disclosure
Per the contribution guide, AI was used to draft the fix, tests, and this
description. I verified the change end-to-end against my own reproduction (a
custom JDBCTableCatalog subclass that also implements ViewCatalog, which was
being incorrectly rewritten to ShowIcebergViews by
IcebergSparkSessionExtensions).
--
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]
