{"record":{"id":"57baf8d5272cec81","repo":"apache/iceberg","slug":"does-not-support-listing-tables","errorCode":null,"errorMessage":" does not support listing tables","messagePattern":" does not support listing tables","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/SparkCachedTableCatalog.java","lineNumber":62,"sourceCode":"\n/** An internal table catalog that is capable of loading tables from a cache. */\npublic class SparkCachedTableCatalog implements TableCatalog, SupportsFunctions {\n\n  private static final String CLASS_NAME = SparkCachedTableCatalog.class.getName();\n  private static final Splitter COMMA = Splitter.on(\",\");\n  private static final Pattern AT_TIMESTAMP = Pattern.compile(\"at_timestamp_(\\\\d+)\");\n  private static final Pattern SNAPSHOT_ID = Pattern.compile(\"snapshot_id_(\\\\d+)\");\n  private static final Pattern BRANCH = Pattern.compile(\"branch_(.*)\");\n  private static final Pattern TAG = Pattern.compile(\"tag_(.*)\");\n  private static final String REWRITE = \"rewrite\";\n\n  private static final SparkTableCache TABLE_CACHE = SparkTableCache.get();\n\n  private String name = null;\n\n  @Override\n  public Identifier[] listTables(String[] namespace) {\n    throw new UnsupportedOperationException(CLASS_NAME + \" does not support listing tables\");\n  }\n\n  @Override\n  public SparkTable loadTable(Identifier ident) throws NoSuchTableException {\n    return load(ident);\n  }\n\n  @Override\n  public SparkTable loadTable(Identifier ident, String version) throws NoSuchTableException {\n    SparkTable table = load(ident);\n    Preconditions.checkArgument(\n        table.snapshotId() == null, \"Cannot time travel based on both table identifier and AS OF\");\n    return table.copyWithSnapshotId(Long.parseLong(version));\n  }\n\n  @Override\n  public SparkTable loadTable(Identifier ident, long timestampMicros) throws NoSuchTableException {\n    SparkTable table = load(ident);","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/SparkCachedTableCatalog.java#L44-L80","documentation":"SparkCachedTableCatalog is a thin in-memory passthrough that only serves tables already cached in SparkTableCache; it has no backing metadata store, so listing namespaces/tables is meaningless and always throws UnsupportedOperationException.","triggerScenarios":"Executing SHOW TABLES IN <cached-catalog-name> or any Spark catalog query invoking listTables(namespace) on a catalog initialized as org.apache.iceberg.spark.SparkCachedTableCatalog.","commonSituations":"Users pointing a session catalog at the cached-table catalog by mistake, or running SHOW TABLES/SHOW NAMESPACES against it expecting real catalog behavior.","solutions":["Do not run SHOW TABLES against the cached-table catalog; it is not a discoverable catalog","List tables on the underlying Iceberg catalog (e.g. the original session catalog) instead","Reference cached tables directly by the exact cached identifier used when the table was cached"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (catalog instanceof SparkCachedTableCatalog) { /* skip listing; use underlying catalog */ }","typeGuard":null,"tryCatchPattern":"try { return catalog.listTables(namespace); } catch (UnsupportedOperationException e) { return underlyingCatalog.listTables(namespace); }","preventionTips":["Treat SparkCachedTableCatalog as load-only; never run SHOW TABLES/NAMESPACES against it","Route discovery queries to the persistent Iceberg catalog"],"tags":["spark","catalog","unsupported-operation"],"backgroundTag":"operation-not-supported","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}