apache/iceberg · error · UnsupportedOperationException

Cannot convert unknown type to Flink:

Error message

Cannot convert unknown type to Flink: 

What it means

TypeToFlinkType.primitive throws UnsupportedOperationException when an Iceberg primitive type has no corresponding Flink LogicalType in the switch. The message includes the unhandled primitive's toString.

Solutions

  1. Upgrade iceberg-flink to a version that maps the offending type.
  2. Replace the type in the schema with a supported one (e.g. use Types.BinaryType instead of the unknown type).
  3. Filter/project out the unsupported columns before conversion.

Example fix

// before
Schema s = new Schema(required(1, "v", Types.UUIDType.get())); // unmapped in this version
// after
Schema s = new Schema(required(1, "v", Types.BinaryType.get())); // or upgrade connector
Defensive patterns

Strategy: validation

Validate before calling

Set<Type> unsupported = schema.columns().stream().map(Types.NestedField::type)
    .filter(t -> t.isPrimitiveType() && !SUPPORTED.contains(t.typeId()))
    .collect(Collectors.toSet());
if (!unsupported.isEmpty()) throw new IllegalStateException("Unmapped types: " + unsupported);

Type guard

boolean flinkConvertible(Type.PrimitiveType p) { return EnumSet.of(TypeID.BOOLEAN, TypeID.INTEGER, TypeID.LONG, TypeID.FLOAT, TypeID.DOUBLE, TypeID.STRING, TypeID.DATE, TypeID.TIME, TypeID.TIMESTAMP, TypeID.BINARY, TypeID.DECIMAL).contains(p.typeId()); }

Try / catch

try { convert(schema); } catch (UnsupportedOperationException e) { /* prune or upgrade */ }

Prevention

When it happens

Trigger: Converting an Iceberg schema containing a primitive type absent from the switch (e.g. newer types added after this Flink connector version) via FlinkSchemaUtil.convert / TypeToFlinkType.

Common situations: Version skew between schema producer (newer Iceberg) and flink connector (older); exotic types like UUID/variant depending on connector version; programmatically constructed schemas with unusual types.

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

Appendix: source

Thrown at flink/v2.2/flink/src/main/java/org/apache/iceberg/flink/TypeToFlinkType.java:148

        } else {
          // NANOS
          return new TimestampType(9);
        }
      case STRING:
        return new VarCharType(VarCharType.MAX_LENGTH);
      case UUID:
        // UUID length is 16
        return new BinaryType(16);
      case FIXED:
        Types.FixedType fixedType = (Types.FixedType) primitive;
        return new BinaryType(fixedType.length());
      case BINARY:
        return new VarBinaryType(VarBinaryType.MAX_LENGTH);
      case DECIMAL:
        Types.DecimalType decimal = (Types.DecimalType) primitive;
        return new DecimalType(decimal.precision(), decimal.scale());
      default:
        throw new UnsupportedOperationException(
            "Cannot convert unknown type to Flink: " + primitive);
    }
  }
}

View on GitHub (pinned to 86d9c8fc54)