apache/iceberg · error

Cannot use catalog : not a ProcedureCatalog

Error message

Cannot use catalog ${plugin.name}: not a ProcedureCatalog

What it means

Thrown by ResolveProcedures' CatalogHelper.asProcedureCatalog when the catalog resolved from a CALL statement is an Iceberg CatalogPlugin but does not implement the ProcedureCatalog interface, meaning it cannot expose or load procedures.

Solutions

  1. Prefix the CALL with an Iceberg catalog that supports procedures (e.g. CALL my_iceberg_catalog.system.rewrite_data_files(...))
  2. Check which catalog the procedure belongs to and set/qualify accordingly — not all catalogs implement ProcedureCatalog
  3. Upgrade the catalog implementation to an Iceberg version that supports procedures if you expected it to

Example fix

// before
CALL spark_catalog.system.rewrite_data_files(table => 'db.t')
// after
CALL iceberg_catalog.system.rewrite_data_files(table => 'db.t')
Defensive patterns

Strategy: validation

Validate before calling

val plugin = spark.sessionState.catalogManager.catalog(catalogName)
require(plugin.isInstanceOf[ProcedureCatalog],
  s"catalog $catalogName does not support procedures")

Try / catch

try { spark.sql(callSql) } catch { case e: AnalysisException if e.getMessage.contains("not a ProcedureCatalog") => // retarget CALL at an Iceberg catalog }

Prevention

When it happens

Trigger: CALL some_catalog.system.some_procedure(...) where some_catalog is a catalog implementation (e.g. a generic Hive/Hadoop/JDBC catalog) that lacks ProcedureCatalog support.

Common situations: Pointing CALL at the wrong catalog (e.g. session/default catalog instead of the Iceberg catalog); using a catalog plugin version that predates procedure support; misconfigured spark.sql.default-catalog.

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/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/6406bfe175375673. Report an issue: GitHub.

Appendix: source

Thrown at spark/v3.5/spark-extensions/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveProcedures.scala:189

      case param =>
        val normalizedName = param.name.toLowerCase(Locale.ROOT)
        ProcedureParameter.optional(normalizedName, param.dataType)
    }
  }

  private def normalizeArgs(args: Seq[CallArgument]): Seq[CallArgument] = {
    args.map {
      case a @ NamedArgument(name, _) => a.copy(name = name.toLowerCase(Locale.ROOT))
      case other => other
    }
  }

  implicit class CatalogHelper(plugin: CatalogPlugin) {
    def asProcedureCatalog: ProcedureCatalog = plugin match {
      case procedureCatalog: ProcedureCatalog =>
        procedureCatalog
      case _ =>
        throw new AnalysisException(s"Cannot use catalog ${plugin.name}: not a ProcedureCatalog")
    }
  }
}

View on GitHub (pinned to 86d9c8fc54)