apache/iceberg · error · UnsupportedOperationException

Cannot convert unknown type to Flink: ${primitive}

Error message

Cannot convert unknown type to Flink: ${primitive}

What it means

TypeToFlinkType maps an Iceberg primitive type to a Flink LogicalType. The switch over the primitive has no case for the given type, so conversion fails with UnsupportedOperationException. It indicates the Iceberg type is not representable in Flink by this converter (e.g. an unknown or newer-spec Iceberg type).

Source

Thrown at flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/TypeToFlinkType.java:142

        } 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)

Solutions

  1. Verify the table schema only contains Flink-supported Iceberg types
  2. Upgrade the iceberg-flink module to match the iceberg-core version that produced the schema
  3. Extend the converter explicitly if a new type must be supported

Example fix

// before
case UNKNOWN: // falls to default -> throws
// after
case VARIANT: case UNKNOWN:
  throw new IllegalArgumentException("Type not supported by this Flink version: " + primitive);
Defensive patterns

Strategy: validation

Validate before calling

for (Types.NestedField f : schema.columns()) { if (f.type().isPrimitiveType()) checkSupported(f.type().asPrimitiveType()); }

Type guard

boolean supported(Type t) { return !(t instanceof Type.PrimitiveType) || SUPPORTED.contains(((Type.PrimitiveType) t).typeId()); }

Try / catch

try { convert(schema); } catch (UnsupportedOperationException e) { LOG.error("Unsupported Iceberg type for Flink: {}", e.getMessage()); throw e; }

Prevention

When it happens

Trigger: Calling FlinkSchemaUtil.convert / TypeToFlinkType.primitive with an Iceberg type outside the supported set of primitives.

Common situations: Tables written with a newer Iceberg spec exposing types the pinned Flink integration does not know; version skew between iceberg-core and iceberg-flink modules; hand-built schemas with exotic types.

Understand the failure class

Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.

Related errors


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