apache/iceberg · error · UnsupportedOperationException

Unsupported primitive type

Error message

Unsupported primitive type: %s

What it means

Switch default in ColumnWriter.newWriter: the Parquet physical column type has no writer factory case (boolean/int64/float/double/binary/fixed-len-byte-array are handled). The %s is the primitive type; writing this Parquet schema with the vectorized column writer is unsupported at writer construction.

Solutions

  1. Fix the write schema so every column maps to a supported Parquet primitive type
  2. Upgrade Iceberg if the type is newly supported
  3. Drop or cast the unsupported column before writing

Example fix

// before
Types.NestedField f = Types.NestedField.optional(1, "x", unsupportedType);
// after
Types.NestedField f = Types.NestedField.optional(1, "x", Types.StringType.get());
Defensive patterns

Strategy: validation

Validate before calling

schema.columns().forEach(f -> {
  if (!SUPPORTED_ICEBERG_TYPES.contains(f.type())) throw new IllegalArgumentException("Unsupported for parquet write: " + f.type());
});

Try / catch

try {
  df.write().format("iceberg").mode("append").save(tableName);
} catch (UnsupportedOperationException e) {
  if (e.getMessage().contains("Unsupported primitive type")) { /* fix schema */ }
}

Prevention

When it happens

Trigger: Writing data to Parquet with a column descriptor whose PrimitiveTypeName is not handled by the switch in newWriter.

Common situations: Attempting to write data whose schema maps to an unsupported Parquet physical type; custom or synthetic schemas; bugs in type mapping upstream of the writer.

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/5ab56db9a87ddddd. Report an issue: GitHub.

Appendix: source

Thrown at parquet/src/main/java/org/apache/iceberg/parquet/ColumnWriter.java:79

      case DOUBLE:
        return (ColumnWriter<T>)
            new ColumnWriter<Double>(desc) {
              @Override
              public void write(int rl, Double value) {
                writeDouble(rl, value);
              }
            };
      case FIXED_LEN_BYTE_ARRAY:
      case BINARY:
        return (ColumnWriter<T>)
            new ColumnWriter<Binary>(desc) {
              @Override
              public void write(int rl, Binary value) {
                writeBinary(rl, value);
              }
            };
      default:
        throw new UnsupportedOperationException(
            "Unsupported primitive type: " + desc.getPrimitiveType().getPrimitiveTypeName());
    }
  }

  private final ColumnDescriptor desc;
  private final int maxDefinitionLevel;

  private org.apache.parquet.column.ColumnWriter columnWriter = null;

  private ColumnWriter(ColumnDescriptor desc) {
    this.desc = desc;
    this.maxDefinitionLevel = desc.getMaxDefinitionLevel();
  }

  public void setColumnStore(ColumnWriteStore columnStore) {
    this.columnWriter = columnStore.getColumnWriter(desc);
  }

View on GitHub (pinned to 86d9c8fc54)