{"record":{"id":"7b6c914b231326a6","repo":"apache/iceberg","slug":"class-name-does-not-support-listing-tables","errorCode":null,"errorMessage":"${CLASS_NAME} does not support listing tables","messagePattern":"(.+?) does not support listing tables","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/SparkRewriteTableCatalog.java","lineNumber":44,"sourceCode":"import org.apache.spark.sql.catalyst.analysis.NoSuchTableException;\nimport org.apache.spark.sql.catalyst.analysis.TableAlreadyExistsException;\nimport org.apache.spark.sql.connector.catalog.Identifier;\nimport org.apache.spark.sql.connector.catalog.TableCatalog;\nimport org.apache.spark.sql.connector.catalog.TableChange;\nimport org.apache.spark.sql.connector.expressions.Transform;\nimport org.apache.spark.sql.types.StructType;\nimport org.apache.spark.sql.util.CaseInsensitiveStringMap;\n\npublic class SparkRewriteTableCatalog implements TableCatalog, SupportsFunctions {\n\n  private static final String CLASS_NAME = SparkRewriteTableCatalog.class.getName();\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 SparkRewriteTable loadTable(Identifier ident) throws NoSuchTableException {\n    validateNoNamespace(ident);\n\n    String groupId = ident.name();\n    Table table = TABLE_CACHE.get(groupId);\n\n    if (table == null) {\n      throw new NoSuchTableException(ident);\n    }\n\n    return new SparkRewriteTable(table, groupId);\n  }\n\n  @Override\n  public SparkTable loadTable(Identifier ident, String version) throws NoSuchTableException {","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/SparkRewriteTableCatalog.java#L26-L62","documentation":"SparkRewriteTableCatalog is a minimal catalog plugin used only to service the rewrite-table procedure; it has no real table store behind it, so listTables always throws UnsupportedOperationException. It deliberately implements none of the general catalog management operations.","triggerScenarios":"Calling listTables(namespace) on a catalog instance of class SparkRewriteTableCatalog, e.g. via SHOW TABLES against a catalog registered as that class.","commonSituations":"Misconfiguring spark.sql.catalog.<name>.catalog-impl to the rewrite catalog instead of a real Iceberg catalog; programmatic calls on a rewrite-procedure catalog handle.","solutions":["Use a real Iceberg catalog implementation (HiveCatalog, HadoopCatalog, RESTCatalog) for general table operations","Ensure spark.sql.catalog.<name>.catalog-impl is not set to SparkRewriteTableCatalog","Invoke the rewrite_data_files/rewrite_manifests procedures rather than treating the rewrite catalog as a normal catalog"],"exampleFix":"// before\nspark.conf.set(\"spark.sql.catalog.prod.catalog-impl\", \"org.apache.iceberg.spark.SparkRewriteTableCatalog\")\n// after\nspark.conf.set(\"spark.sql.catalog.prod.catalog-impl\", \"org.apache.iceberg.spark.SparkCatalog\")","handlingStrategy":"validation","validationCode":"val impl = spark.conf.get(\"spark.sql.catalog.prod.catalog-impl\", \"org.apache.iceberg.spark.SparkCatalog\")\nrequire(impl != \"org.apache.iceberg.spark.SparkRewriteTableCatalog\", \"prod must use a real catalog\")","typeGuard":null,"tryCatchPattern":"try {\n  catalog.listTables(namespace)\n} catch {\n  case _: UnsupportedOperationException => useRealCatalogInstead()\n}","preventionTips":["Bind general-purpose catalogs with SparkCatalog, not SparkRewriteTableCatalog","Use CALL procedures for rewrites instead of the rewrite catalog handle","Document catalog bindings per namespace in session setup"],"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"}