apache/iceberg · error · IllegalArgumentException

Unsupported Spark view dependency type:

Error message

Unsupported Spark view dependency type: 

What it means

SparkViewDependenciesParser.fromJson() validates each dependency node's 'type' field against TABLE and FUNCTION. An unrecognized type string throws IllegalArgumentException('Unsupported Spark view dependency type: ' + type), guarding forward-compat for dependency kinds written by newer versions.

Source

Thrown at spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/source/SparkViewDependenciesParser.java:100

    } catch (IOException e) {
      throw new UncheckedIOException("Failed to parse Spark view dependencies", e);
    }

    Preconditions.checkArgument(
        node.isArray(), "Cannot parse Spark view dependencies from non-array: %s", node);
    ImmutableList.Builder<Dependency> dependenciesBuilder = ImmutableList.builder();
    for (JsonNode dependency : node) {
      String type = string(TYPE, dependency);
      String[] nameParts = stringArray(NAME_PARTS, dependency);
      switch (type) {
        case TABLE:
          dependenciesBuilder.add(Dependency.table(nameParts));
          break;
        case FUNCTION:
          dependenciesBuilder.add(Dependency.function(nameParts));
          break;
        default:
          throw new IllegalArgumentException("Unsupported Spark view dependency type: " + type);
      }
    }

    return DependencyList.of(dependenciesBuilder.build().toArray(new Dependency[0]));
  }

  private static String string(String property, JsonNode node) {
    JsonNode value = node.get(property);
    Preconditions.checkArgument(
        value != null && value.isTextual(),
        "Cannot parse Spark view dependency string: %s: %s",
        property,
        value);
    return value.asText();
  }

  private static String[] stringArray(String property, JsonNode node) {
    JsonNode values = node.get(property);

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Upgrade the Iceberg Spark runtime to match the version that wrote the view
  2. Correct the type field in metadata to 'table' or 'function' if hand-edited
  3. Recreate the view with only table/function dependencies
  4. Check the type value in the error message and compare against the connector's supported set

Example fix

// before
{"type":"model","name-parts":["db","m"]}
// after
{"type":"table","name-parts":["db","t"]}
Defensive patterns

Strategy: validation

Validate before calling

for (JsonNode d : depsArray) { String type = d.get("type").asText(); if (!type.equals("table") && !type.equals("function")) throw new IllegalArgumentException("Unknown dependency type: " + type); }

Type guard

boolean knownType(String type) { return "table".equals(type) || "function".equals(type); }

Try / catch

try { deps = SparkViewDependenciesParser.fromJson(json); } catch (IllegalArgumentException e) { log.warn("Unknown dependency type from newer writer: {}", e.getMessage()); throw e; }

Prevention

When it happens

Trigger: Reading a view written by a newer Iceberg/Spark version that serialized a dependency type this connector doesn't know, or metadata with a typo'd/unknown type value.

Common situations: Downgrade scenarios (view created with newer connector, read with older); hand-edited metadata changing the type field; third-party tools writing custom dependency types.

Related errors


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