apache/iceberg · error · IllegalArgumentException

Unsupported type: ${primitive}

Error message

Unsupported type: ${primitive}

What it means

FlinkAvroWriter maps Iceberg primitive types to Avro ValueWriters. When the primitive's type falls into no supported case, the method throws IllegalArgumentException 'Unsupported type'. The write path only handles a fixed set of Iceberg primitives.

Source

Thrown at flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/data/FlinkAvroWriter.java:169

            case SMALLINT:
              return ValueWriters.shorts();
            default:
              return ValueWriters.ints();
          }
        case LONG:
          return ValueWriters.longs();
        case FLOAT:
          return ValueWriters.floats();
        case DOUBLE:
          return ValueWriters.doubles();
        case STRING:
          return FlinkValueWriters.strings();
        case FIXED:
          return ValueWriters.fixed(primitive.getFixedSize());
        case BYTES:
          return ValueWriters.bytes();
        default:
          throw new IllegalArgumentException("Unsupported type: " + primitive);
      }
    }
  }
}

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Align the iceberg-flink version with the iceberg-core version that produced the schema
  2. Check the table schema and replace unsupported types with supported equivalents
  3. Extend the switch in FlinkAvroWriter if the type must be written

Example fix

// before
Types.TimestampNanoPrecision in schema -> FlinkAvroWriter throws
// after
Use timestamp(6) in schema, or upgrade iceberg-flink to a version supporting nanos
Defensive patterns

Strategy: validation

Validate before calling

schema.columns().forEach(f -> checkTypeSupported(f.type()));

Try / catch

try { write(table); } catch (IllegalArgumentException e) { LOG.error("Unsupported Iceberg type for Avro write: {}", e.getMessage()); throw e; }

Prevention

When it happens

Trigger: Writing Avro files for a table schema containing a primitive the Avro writer does not implement (e.g. newer/unknown Iceberg primitives).

Common situations: Schema written by a newer Iceberg version than the Flink integration in use; tables containing exotic types pushed through the Avro path; module version skew between iceberg-core and iceberg-flink.

Related errors


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