{"record":{"id":"0bbfad71cded16fb","repo":"apache/seatunnel","slug":"catalog-not-implements-supportsnamespaces-so-can-t","errorCode":null,"errorMessage":"catalog not implements SupportsNamespaces so can't check database exists","messagePattern":"catalog not implements SupportsNamespaces so can't check database exists","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-iceberg/src/main/java/org/apache/seatunnel/connectors/seatunnel/iceberg/catalog/IcebergCatalog.java","lineNumber":125,"sourceCode":"                throw new CatalogException(e);\n            }\n        }\n    }\n\n    @Override\n    public String getDefaultDatabase() throws CatalogException {\n        return \"default\";\n    }\n\n    @Override\n    public boolean databaseExists(String databaseName) throws CatalogException {\n        if (catalog instanceof SupportsNamespaces) {\n            boolean exists =\n                    ((SupportsNamespaces) catalog).namespaceExists(Namespace.of(databaseName));\n            log.info(\"Database {} existence status: {}\", databaseName, exists);\n            return exists;\n        } else {\n            throw new UnsupportedOperationException(\n                    \"catalog not implements SupportsNamespaces so can't check database exists\");\n        }\n    }\n\n    @Override\n    public List<String> listDatabases() throws CatalogException {\n        if (catalog instanceof SupportsNamespaces) {\n            List<String> databases =\n                    ((SupportsNamespaces) catalog)\n                            .listNamespaces().stream()\n                                    .map(Namespace::toString)\n                                    .collect(Collectors.toList());\n            log.info(\"Fetched {} namespaces.\", databases.size());\n            return databases;\n        } else {\n            throw new UnsupportedOperationException(\n                    \"catalog not implements SupportsNamespaces so can't list databases\");\n        }","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-iceberg/src/main/java/org/apache/seatunnel/connectors/seatunnel/iceberg/catalog/IcebergCatalog.java#L107-L143","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Use a catalog implementation that supports namespaces (HiveCatalog, HadoopCatalog, Nessie/JDBC catalogs) instead of the current one","Remove or bypass the database-existence pre-check for this catalog type and create the namespace explicitly if the impl allows it","Implement/extend your custom catalog to implement SupportsNamespaces"],"exampleFix":"// before: catalog type = custom-catalog (no namespace support)\ncatalog { name = \"custom-catalog\" }\n// after\ncatalog { name = \"hadoop\" } // implements SupportsNamespaces","handlingStrategy":"type-guard","validationCode":"org.apache.iceberg.catalog.Catalog icebergCatalog = catalogFactory.create();\nboolean canCheckDb = icebergCatalog instanceof SupportsNamespaces;\nif (!canCheckDb) { /* avoid databaseExists or pick another catalog */ }","typeGuard":"if (catalog instanceof SupportsNamespaces) {\n    SupportsNamespaces ns = (SupportsNamespaces) catalog;\n    // safe to use ns.namespaceExists(...)\n}","tryCatchPattern":"try {\n  boolean exists = seaTunnelCatalog.databaseExists(path.getDatabaseName());\n} catch (UnsupportedOperationException e) {\n  // fall back: skip namespace pre-check or switch catalog impl\n}","preventionTips":["Choose catalog implementations that implement SupportsNamespaces when you need database-level checks","Feature-detect via instanceof before calling databaseExists","Document which catalog types your pipeline supports"],"tags":["iceberg","catalog","namespaces","unsupported"],"backgroundTag":"unsupported-operation","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}