apache/iceberg · error · UnsupportedOperationException

SnowflakeCatalog does not currently support defaultWarehouse

Error message

SnowflakeCatalog does not currently support defaultWarehouseLocation

What it means

SnowflakeCatalog's BaseCatalog hook defaultWarehouseLocation (used when creating new tables by deriving a default storage location) is not implemented. Snowflake tables live in Snowflake-managed locations, so the catalog cannot compute a warehouse path, and any table-creation path that needs a default location throws UnsupportedOperationException.

Source

Thrown at snowflake/src/main/java/org/apache/iceberg/snowflake/SnowflakeCatalog.java:262

    String fileIOImpl = DEFAULT_FILE_IO_IMPL;
    if (catalogProperties.containsKey(CatalogProperties.FILE_IO_IMPL)) {
      fileIOImpl = catalogProperties.get(CatalogProperties.FILE_IO_IMPL);
    }

    // Initialize a fresh FileIO for each TableOperations created, because some FileIO
    // implementations such as S3FileIO can become bound to a single S3 bucket. Additionally,
    // FileIO implementations often support only a finite set of one or more URI schemes (i.e.
    // S3FileIO only supports s3/s3a/s3n, and even ResolvingFileIO only supports the combination
    // of schemes registered for S3FileIO and HadoopFileIO). Individual catalogs may need to
    // support tables across different cloud/storage providers with disjoint FileIO implementations.
    FileIO fileIO = fileIOFactory.newFileIO(fileIOImpl, catalogProperties, conf);
    closeableGroup.addCloseable(fileIO);
    return new SnowflakeTableOperations(snowflakeClient, fileIO, catalogName, tableIdentifier);
  }

  @Override
  protected String defaultWarehouseLocation(TableIdentifier tableIdentifier) {
    throw new UnsupportedOperationException(
        "SnowflakeCatalog does not currently support defaultWarehouseLocation");
  }

  @Override
  public void setConf(Object conf) {
    this.conf = conf;
  }
}

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Always supply an explicit location when creating tables via SnowflakeCatalog: createTable(ident, schema, spec, sortOrder, properties, location) with a valid object-storage URI.
  2. In Spark, add a LOCATION clause to CREATE TABLE statements targeting the Snowflake catalog.
  3. Prefer CREATE TABLE ... AS SELECT through Snowflake itself (the SnowflakeCatalog mainly exposes existing Snowflake-managed Iceberg tables); create Iceberg tables via Snowflake SQL instead of the Iceberg API.
  4. If default-location creation is required, use a catalog that supports defaultWarehouseLocation (Hadoop/Hive/Nessie).

Example fix

// before
catalog.createTable(TableIdentifier.of("db", "t"), schema, PartitionSpec.unpartitioned());
// after
catalog.createTable(TableIdentifier.of("db", "t"), schema, PartitionSpec.unpartitioned(),
    "s3://my-bucket/warehouse/db/t");
Defensive patterns

Strategy: validation

Validate before calling

Preconditions.checkArgument(location != null && !location.isEmpty(),
    "SnowflakeCatalog requires an explicit table location");
catalog.createTable(ident, schema, spec, sortOrder, props, location);

Try / catch

try { catalog.createTable(ident, schema, spec); } catch (UnsupportedOperationException e) { /* retry with explicit location */ catalog.createTable(ident, schema, spec, sortOrder, props, location); }

Prevention

When it happens

Trigger: Creating a table through SnowflakeCatalog without an explicit location: catalog.createTable(ident, schema, spec, null /* no location */) or SQL CREATE TABLE without a LOCATION clause routed through this catalog.

Common situations: Spark 'CREATE TABLE ... (no LOCATION)' against a Snowflake catalog; tooling that creates staging/sink tables assuming the catalog derives locations; CTAS pipelines ported from Hadoop/Hive catalogs.

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/0de92302a69bac9c. Report an issue: GitHub.