apache/seatunnel · error · UnsupportedOperationException

catalog not implements SupportsNamespaces so can't check dat

Error message

catalog not implements SupportsNamespaces so can't check database exists

What it means

IcebergCatalog.databaseExists only supports namespace existence checks when the underlying Iceberg org.apache.iceberg.catalog.Catalog implements SupportsNamespaces. When it doesn't, the method throws UnsupportedOperationException stating it cannot check whether the database exists.

Source

Thrown at seatunnel-connectors-v2/connector-iceberg/src/main/java/org/apache/seatunnel/connectors/seatunnel/iceberg/catalog/IcebergCatalog.java:125

                throw new CatalogException(e);
            }
        }
    }

    @Override
    public String getDefaultDatabase() throws CatalogException {
        return "default";
    }

    @Override
    public boolean databaseExists(String databaseName) throws CatalogException {
        if (catalog instanceof SupportsNamespaces) {
            boolean exists =
                    ((SupportsNamespaces) catalog).namespaceExists(Namespace.of(databaseName));
            log.info("Database {} existence status: {}", databaseName, exists);
            return exists;
        } else {
            throw new UnsupportedOperationException(
                    "catalog not implements SupportsNamespaces so can't check database exists");
        }
    }

    @Override
    public List<String> listDatabases() throws CatalogException {
        if (catalog instanceof SupportsNamespaces) {
            List<String> databases =
                    ((SupportsNamespaces) catalog)
                            .listNamespaces().stream()
                                    .map(Namespace::toString)
                                    .collect(Collectors.toList());
            log.info("Fetched {} namespaces.", databases.size());
            return databases;
        } else {
            throw new UnsupportedOperationException(
                    "catalog not implements SupportsNamespaces so can't list databases");
        }

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Use a catalog implementation that supports namespaces (HiveCatalog, HadoopCatalog, Nessie/JDBC catalogs) instead of the current one
  2. Remove or bypass the database-existence pre-check for this catalog type and create the namespace explicitly if the impl allows it
  3. Implement/extend your custom catalog to implement SupportsNamespaces

Example fix

// before: catalog type = custom-catalog (no namespace support)
catalog { name = "custom-catalog" }
// after
catalog { name = "hadoop" } // implements SupportsNamespaces
Defensive patterns

Strategy: type-guard

Validate before calling

org.apache.iceberg.catalog.Catalog icebergCatalog = catalogFactory.create();
boolean canCheckDb = icebergCatalog instanceof SupportsNamespaces;
if (!canCheckDb) { /* avoid databaseExists or pick another catalog */ }

Type guard

if (catalog instanceof SupportsNamespaces) {
    SupportsNamespaces ns = (SupportsNamespaces) catalog;
    // safe to use ns.namespaceExists(...)
}

Try / catch

try {
  boolean exists = seaTunnelCatalog.databaseExists(path.getDatabaseName());
} catch (UnsupportedOperationException e) {
  // fall back: skip namespace pre-check or switch catalog impl
}

Prevention

When it happens

Trigger: databaseExists is called on a catalog factory-produced catalog whose class implements only the base Catalog interface (e.g. some custom or restricted catalog implementations without namespace support).

Common situations: Using a catalog type (custom Hadoop-less or third-party catalog) that lacks SupportsNamespaces while the SeaTunnel job or catalog pre-check calls databaseExists; switching catalog impls between environments.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/0bbfad71cded16fb. Report an issue: GitHub.