apache/iceberg · error · UnsupportedOperationException

Setting a view's location is not supported

Error message

Setting a view's location is not supported

What it means

ViewBuilder.withLocation(String) is a default interface method that throws UnsupportedOperationException. The builder default signals that setting an explicit view location is optional to implement; view builders without location support throw this error.

Solutions

  1. Omit withLocation() and let the catalog choose the view's default location.
  2. Use a catalog implementation whose ViewBuilder supports explicit locations.
  3. Set the location through catalog configuration (warehouse/base location properties) instead.

Example fix

// before
builder.withLocation("s3://bucket/views/v1").create();

// after
ViewBuilder b = builder; // catalog derives location if unsupported
View v = b.withSchema(schema)... .create();
Defensive patterns

Strategy: fallback

Try / catch

try { builder.withLocation(loc); } catch (UnsupportedOperationException e) { /* omit withLocation, accept catalog default */ }

Prevention

When it happens

Trigger: Calling catalog.buildView(...).withLocation(location) during view creation with a ViewBuilder implementation that does not override withLocation().

Common situations: Creating views with a custom storage location in catalogs whose builder derives the location automatically; test stubs of ViewBuilder.

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/7992a32309f72e7e. Report an issue: GitHub.

Appendix: source

Thrown at api/src/main/java/org/apache/iceberg/view/ViewBuilder.java:55

  ViewBuilder withProperties(Map<String, String> properties);

  /**
   * Add a key/value property to the view.
   *
   * @param key a key
   * @param value a value
   * @return this for method chaining
   */
  ViewBuilder withProperty(String key, String value);

  /**
   * Sets a location for the view
   *
   * @param location the location to set for the view
   * @return this for method chaining
   */
  default ViewBuilder withLocation(String location) {
    throw new UnsupportedOperationException("Setting a view's location is not supported");
  }

  /**
   * Create the view.
   *
   * @return the view created
   */
  View create();

  /**
   * Replace the view.
   *
   * @return the {@link View} replaced
   */
  View replace();

  /**
   * Create or replace the view.

View on GitHub (pinned to 86d9c8fc54)