apache/iceberg · error · UnsupportedOperationException

<type> is not supported

Error message

<type> is not supported

What it means

HiveSchemaUtil.convertToTypeString throws UnsupportedOperationException when asked to convert an Iceberg type that has no Hive DDL string representation in its switch (only structured MAP/list-like branches plus primitives are handled; the default arm rejects the rest). Used when writing Iceberg schemas back as Hive type strings.

Source

Thrown at hive-metastore/src/main/java/org/apache/iceberg/hive/HiveSchemaUtil.java:190

      case DECIMAL:
        final Types.DecimalType decimalType = (Types.DecimalType) type;
        return String.format("decimal(%s,%s)", decimalType.precision(), decimalType.scale());
      case STRUCT:
        final Types.StructType structType = type.asStructType();
        final String nameToType =
            structType.fields().stream()
                .map(f -> String.format("%s:%s", f.name(), convert(f.type())))
                .collect(Collectors.joining(","));
        return String.format("struct<%s>", nameToType);
      case LIST:
        final Types.ListType listType = type.asListType();
        return String.format("array<%s>", convert(listType.elementType()));
      case MAP:
        final Types.MapType mapType = type.asMapType();
        return String.format(
            "map<%s,%s>", convert(mapType.keyType()), convert(mapType.valueType()));
      default:
        throw new UnsupportedOperationException(type + " is not supported");
    }
  }
}

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Simplify the Iceberg schema (e.g. replace the unsupported type with string/struct) before converting.
  2. Check which type hits the default arm by inspecting the message ('<type> is not supported') and map it manually.
  3. Update HiveSchemaUtil to add a mapping if the type is representable in your Hive version.

Example fix

// before
Types.NestedField f = Types.NestedField.of(1, false, "v", Types.VariantType.get()); // no Hive mapping
// after
Types.NestedField f = Types.NestedField.of(1, false, "v", Types.StringType.get());
Defensive patterns

Strategy: validation

Validate before calling

schema.columns().forEach(f -> { if (!(f.type() instanceof Types.StringType || f.type() instanceof Types.StructType || f.type() instanceof Types.MapType || f.type() instanceof Types.ListType || f.type() instanceof Types.PrimitiveType)) throw new IllegalStateException("type not Hive-representable: " + f.type()); });

Try / catch

try { String ddl = HiveSchemaUtil.convert(schema); } catch (UnsupportedOperationException e) { /* replace offending type then retry */ }

Prevention

When it happens

Trigger: Calling HiveSchemaUtil.convert with an Iceberg type falling to the default arm — e.g. nested unsupported structures or less common types — during Hive DDL/serde type-string generation.

Common situations: Creating Hive-compatible views or conversions over Iceberg schemas containing types Hive cannot express; syncing Iceberg schemas into Hive for query engines with limited type support.

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