apache / apache/amoro

[Bug]: Opening a Hive view from the Tables page causes a NullPointerException

Closed
#4,350 0 comments 0 reactions 0 assignees View on GitHub
type:bug
Dominant language
Java
Stars
1.2k
Forks
395
Avg merge
4d 10h
Merged PRs (30d)
33

Description

### What happened?

When an external Hive catalog contains a Hive view, the view may be returned by Hive Metastore table listing APIs and exposed on the Amoro Tables page as a manageable table.

### Actual behavior

Opening the view invokes the normal table detail endpoint. CommonUnifiedCatalog attempts to load it through the configured format catalogs, and MixedHiveCatalog handles the Hive view as a physical table. The view has no storage location, so MixedHiveCatalog.getMixedTableMeta calls `endsWith` on a null location and throws a NullPointerException. The detail request returns HTTP 500 and the page cannot be opened.

### Expected behavior

Hive virtual and materialized views should not be exposed as manageable Amoro tables. Loading a view through a physical table path should return a clear not-found or unsupported result instead of throwing a NullPointerException. Regular physical tables should remain unaffected.

### Affects Versions

master

### What table formats are you seeing the problem on?

Iceberg, Mixed-Hive

### What engines are you seeing the problem on?

_No response_

### How to reproduce

1. Configure an external Hive catalog in Amoro.
2. Create a physical table and a Hive view in the same database.
3. Open the database from the Tables page.
4. Observe that the Hive view is listed as a manageable table.
5. Open the view entry.
6. Observe that the detail request returns HTTP 500 with a NullPointerException from MixedHiveCatalog.getMixedTableMeta.

### Relevant log output

```shell
java.lang.NullPointerException: null
at org.apache.amoro.hive.catalog.MixedHiveCatalog.getMixedTableMeta(MixedHiveCatalog.java:195)
at org.apache.amoro.hive.catalog.MixedHiveCatalog.loadTable(MixedHiveCatalog.java:347)
at org.apache.amoro.formats.mixed.MixedCatalog.loadTable(MixedCatalog.java:72)
at org.apache.amoro.CommonUnifiedCatalog.loadTable(CommonUnifiedCatalog.java:134)
at org.apache.amoro.server.dashboard.ServerTableDescriptor.getTableDetail(ServerTableDescriptor.java:75)
at org.apache.amoro.server.dashboard.controller.TableController.getTableDetail(TableController.java:151)
```

### Anything else

Hive views should remain available to query engines that support them, but they should not be treated as Iceberg, Mixed Hive, or native Hive physical tables by Amoro table management.

### Are you willing to submit a PR?

- [x] Yes I am willing to submit a PR!

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct

Contributor guide

Open the contributing guide

Research direction

Start with MixedHiveCatalog.getMixedTableMeta and loadTable, then trace MixedCatalog.loadTable and CommonUnifiedCatalog.loadTable using the stack trace. Check how the Tables page and ServerTableDescriptor handle Hive views versus physical tables; done means views are not exposed as manageable tables or produce a clear unsupported/not-found result, while physical tables still open normally.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
70/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.