apache/iceberg · error · NoSuchViewException

View does not exist: ident

Error message

View does not exist: ident

What it means

SparkCatalog.loadView throws NoSuchViewException when the view catalog cannot load the identifier, or when asViewCatalog is null (catalog does not support views). The identifier in the message is the Spark identifier requested by the caller.

Source

Thrown at spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java:598

          .toArray(Identifier[]::new);
    }

    return new Identifier[0];
  }

  @Override
  public boolean viewExists(Identifier ident) {
    return asViewCatalog != null && asViewCatalog.viewExists(buildIdentifier(ident));
  }

  @Override
  public View loadView(Identifier ident) throws NoSuchViewException {
    if (null != asViewCatalog) {
      try {
        org.apache.iceberg.view.View view = asViewCatalog.loadView(buildIdentifier(ident));
        return new SparkView(catalogName, view);
      } catch (org.apache.iceberg.exceptions.NoSuchViewException e) {
        throw new NoSuchViewException(ident);
      }
    }

    throw new NoSuchViewException(ident);
  }

  @Override
  public View createView(
      Identifier ident,
      String sql,
      String currentCatalog,
      String[] currentNamespace,
      StructType schema,
      String[] queryColumnNames,
      String[] columnAliases,
      String[] columnComments,
      Map<String, String> properties)
      throws ViewAlreadyExistsException, NoSuchNamespaceException {

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Verify the view exists: SHOW VIEWS IN <catalog>.<namespace>
  2. Check the fully qualified name including catalog (catalog.namespace.view)
  3. Confirm your Iceberg version and catalog support views (ViewCatalog) — upgrade if needed
  4. Recreate the view with CREATE VIEW if it was dropped

Example fix

// before
Dataset<Row> df = spark.table("prod.reporting.daily_sales"); // view dropped
// after
if (spark.catalog().viewExists("prod.reporting.daily_sales")) {
  Dataset<Row> df = spark.table("prod.reporting.daily_sales");
}
Defensive patterns

Strategy: try-catch

Validate before calling

boolean exists = spark.catalog().viewExists("prod.reporting.daily_sales"); // Spark 3.4+
// or check the underlying ViewCatalog:
boolean viewExists = asViewCatalog != null && asViewCatalog.viewExists(ident);

Type guard

boolean viewSupported(Catalog catalog) {
  return catalog instanceof org.apache.iceberg.catalog.ViewCatalog;
}

Try / catch

try {
  View view = sparkCatalog.loadView(ident);
} catch (NoSuchViewException e) {
  // view missing: recreate, or route to a fallback table
}

Prevention

When it happens

Trigger: SELECT/DESCRIBE on a view via an Iceberg catalog that supports views (asViewCatalog non-null) but the view does not exist; or any view lookup on a catalog without view support (asViewCatalog null).

Common situations: Querying a view that was dropped or renamed; typo or wrong case in the view name; using an older Iceberg runtime/catalog that predates view support with Spark views in the plan; referencing the view in the wrong catalog (spark.sql.defaultCatalog).

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/375f0dc589ef20b0. Report an issue: GitHub.