apache / apache/iceberg

REST Catalog: Attempting to load a table with a reserved name (e.g., snapshots) before creation causes an error

Open
#13,115 6 comments 0 reactions 0 assignees View on GitHub
bug not-stale
Dominant language
Java
Stars
9.2k
Forks
3.5k
Avg merge
2d 11h
Merged PRs (30d)
132

Description

### Apache Iceberg version

1.9.0 (latest release)

### Query engine

Spark

### Please describe the bug 🐞

# Description
When using the Spark engine with the REST Catalog, attempting to load a table that has a reserved name (e.g., metadata, snapshots, etc.) before creating it triggers an unexpected error. This behavior check for table existence before creation.

# Steps to Reproduce
just past this code in org.apache.iceberg.rest.TestRESTCatalog
```java
@Test
public void reproduceError(){
RESTCatalog catalog = catalog();
catalog.createNamespace(Namespace.of("newdb"));
TableIdentifier identifier = TableIdentifier.of("newdb", "snapshots");
if(catalog.tableExists(identifier)){
catalog.buildTable(identifier, SCHEMA).create();
}
catalog.loadTable(identifier);
}
```

# Expected Behavior
Loading a non-existent table should return false if the table does not exist.
Creating a table with a reserved name should success

# Actual Behavior
throw errors in `TableIdentifier identifier = TableIdentifier.of("newdb", "snapshots");`

### Willingness to contribute

- [x] I can contribute a fix for this bug independently
- [x] I would be willing to contribute a fix for this bug with guidance from the Iceberg community
- [ ] I cannot contribute a fix for this bug at this time

Contributor guide

Open the contributing guide

Research direction

Start in org.apache.iceberg.rest.TestRESTCatalog and run the provided reproduction with a reserved table name such as snapshots. Trace RESTCatalog.tableExists, buildTable, and loadTable for that identifier, then add coverage showing the expected behavior for a non-existent reserved-name table and successful creation before running the REST catalog tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spark
Domain
api, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.