apache/iceberg · error · IllegalArgumentException

Unsupported type: " + primitive

Error message

Unsupported type: " + primitive

What it means

FlinkPlannedAvroReader's primitive switch handles fixed Avro primitive types (NULL, BOOLEAN, INT, LONG, FLOAT, DOUBLE, STRING, RECORD, MAP, LIST, UNION, FIXED, BYTES, ENUM); any other Avro type reaches the default branch and throws IllegalArgumentException 'Unsupported type: <primitive>'. This fails fast for Avro constructs the planned reader cannot decode.

Source

Thrown at flink/v2.2/flink/src/main/java/org/apache/iceberg/flink/data/FlinkPlannedAvroReader.java:198

        case LONG:
          return ValueReaders.longs();
        case FLOAT:
          if (partner != null && partner.typeId() == Type.TypeID.DOUBLE) {
            return ValueReaders.floatsAsDoubles();
          }
          return ValueReaders.floats();
        case DOUBLE:
          return ValueReaders.doubles();
        case STRING:
          return FlinkValueReaders.strings();
        case FIXED:
          return ValueReaders.fixed(primitive.getFixedSize());
        case BYTES:
          return ValueReaders.bytes();
        case ENUM:
          return FlinkValueReaders.enums(primitive.getEnumSymbols());
        default:
          throw new IllegalArgumentException("Unsupported type: " + primitive);
      }
    }
  }
}

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Inspect the Avro schema and normalize the unsupported type to a standard Avro primitive
  2. Regenerate/rewrite the data with a standard Avro schema
  3. Upgrade Iceberg if the type is newly standardized and supported in later versions

Example fix

// before: schema contains non-standard type extension
// after: use standard Avro types, e.g.
{"type":"string"} instead of vendor extension
Defensive patterns

Strategy: try-catch

Validate before calling

Preconditions.checkArgument(KNOWN_AVRO_TYPES.contains(avroType.getType()),
    "Unsupported Avro type: " + avroType.getType());
// KNOWN_AVRO_TYPES = NULL, BOOLEAN, INT, LONG, FLOAT, DOUBLE, STRING,
// RECORD, ENUM, ARRAY, MAP, UNION, FIXED, BYTES

Try / catch

try {
  reader = builder.primitive(primitive);
} catch (IllegalArgumentException e) {
  throw new AvroReadException("Unsupported Avro primitive: " + e.getMessage(), e);
}

Prevention

When it happens

Trigger: Building a reader for an Avro schema containing an exotic primitive type outside the handled set (rare, e.g. non-standard extensions) through FlinkPlannedAvroReader.primitive.

Common situations: Malformed or vendor-extended Avro schemas, reading files whose schema was tampered with, or using an Avro feature ahead of the Iceberg version's 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/f99e41c9ad8a7d36. Report an issue: GitHub.