apache/iceberg · error · UnsupportedOperationException

Unsupported logical type: ${primitive.getOriginalType()}

Error message

Unsupported logical type: ${primitive.getOriginalType()}

What it means

FlinkParquetWriters.primitive() builds a Parquet value writer for a primitive column. When the column carries a logical type annotation, it delegates to LogicalTypeWriterBuilder; if that visitor returns no writer for the annotation, this UnsupportedOperationException is thrown. It means the Parquet file's logical type is not one Iceberg's Flink writer can map to a Flink data type.

Source

Thrown at flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/data/FlinkParquetWriters.java:171

    }

    private ParquetValueWriter<?> newOption(Type fieldType, ParquetValueWriter<?> writer) {
      int maxD = type.getMaxDefinitionLevel(path(fieldType.getName()));
      return ParquetValueWriters.option(fieldType, maxD, writer);
    }

    @Override
    public ParquetValueWriter<?> primitive(LogicalType fType, PrimitiveType primitive) {
      ColumnDescriptor desc = type.getColumnDescription(currentPath());

      LogicalTypeAnnotation annotation = primitive.getLogicalTypeAnnotation();
      if (annotation != null) {
        Optional<ParquetValueWriter<?>> writer =
            annotation.accept(new LogicalTypeWriterBuilder(fType, desc));
        if (writer.isPresent()) {
          return writer.get();
        } else {
          throw new UnsupportedOperationException(
              "Unsupported logical type: " + primitive.getOriginalType());
        }
      }

      switch (primitive.getPrimitiveTypeName()) {
        case FIXED_LEN_BYTE_ARRAY:
        case BINARY:
          return byteArrays(desc);
        case BOOLEAN:
          return ParquetValueWriters.booleans(desc);
        case INT32:
          return ints(fType, desc);
        case INT64:
          return ParquetValueWriters.longs(desc);
        case FLOAT:
          return ParquetValueWriters.floats(desc);
        case DOUBLE:
          return ParquetValueWriters.doubles(desc);

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Identify the offending column's logical type from the message and rewrite the data with a supported logical type (int32/int64/binary/decimal/timestamp/uuid).
  2. Align the parquet-column dependency version with the one required by the Iceberg Flink runtime to ensure all standard logical types are handled.
  3. If the type is genuinely unsupported, project/drop the column before writing, or add a case to LogicalTypeWriterBuilder for the annotation.
  4. Check for duplicate/old parquet jars shading conflicting LogicalTypeAnnotation classes into the Flink job classpath.

Example fix

// before: writing a column annotated with an unsupported logical type
schema.add("weird", Types.IntegerType.get()); // parquet column has INTERVAL annotation
// after: convert data to a supported Iceberg type before writing
schema.add("weird", Types.StringType.get()); // or cast the source column to a supported type
Defensive patterns

Strategy: validation

Validate before calling

MessageType schema = parquetFileSchema();
schema.getFields().forEach(f -> {
  if (f.isPrimitive() && ((PrimitiveType) f).getLogicalTypeAnnotation() != null) {
    // ensure annotation is one of: decimal, timestamp(micros/nanos), date, string,
    // enum, uuid, time(micros/nanos), int(bitWidth, signed)
  }
});

Try / catch

try {
  writer = FlinkParquetWriters.writeBuilder(fileType, schema).build();
} catch (UnsupportedOperationException e) {
  throw new IllegalStateException("Parquet logical type not supported: " + e.getMessage(), e);
}

Prevention

When it happens

Trigger: Writing Parquet via FlinkParquetWriters when a primitive column has a logical type annotation (e.g. an unusual or newer logical type like INTERVAL or a map/list annotation variant) that LogicalTypeWriterBuilder.visit methods do not handle, so Optional.empty() is returned.

Common situations: Reading/writing Parquet files produced by third-party tools with exotic logical types; a Parquet-runtime upgrade introducing new LogicalTypeAnnotation subclasses not yet handled; mismatched parquet-column versions on the classpath.

Related errors


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