apache/iceberg · error · UnsupportedOperationException

Unsupported type: ${primitive}

Error message

Unsupported type: ${primitive}

What it means

At the end of the physical-type switch in SparkParquetReaders.primitive(), any remaining Parquet primitive type without a dedicated reader throws UnsupportedOperationException('Unsupported type: ...'). This covers physical types that cannot be interpreted as an Iceberg value by the Spark read path.

Source

Thrown at spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/data/SparkParquetReaders.java:310

          } else {
            return new UnboxedReader<>(desc);
          }
        case FLOAT:
          if (expected != null && expected.typeId() == TypeID.DOUBLE) {
            return new FloatAsDoubleReader(desc);
          } else {
            return new UnboxedReader<>(desc);
          }
        case BOOLEAN:
        case INT64:
        case DOUBLE:
          return new UnboxedReader<>(desc);
        case INT96:
          // Impala & Spark used to write timestamps as INT96 without a logical type. For backwards
          // compatibility we try to read INT96 as timestamps.
          return ParquetValueReaders.int96Timestamps(desc);
        default:
          throw new UnsupportedOperationException("Unsupported type: " + primitive);
      }
    }

    protected MessageType type() {
      return type;
    }
  }

  private static class BinaryDecimalReader extends PrimitiveReader<Decimal> {
    private final int scale;

    BinaryDecimalReader(ColumnDescriptor desc, int scale) {
      super(desc);
      this.scale = scale;
    }

    @Override
    public Decimal read(Decimal ignored) {

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Upgrade to a newer Iceberg version that may support the type.
  2. Rewrite the files with Iceberg/Spark to normalize physical types.
  3. Identify the offending column via the Parquet footer and drop or convert it.
Defensive patterns

Strategy: try-catch

Validate before calling

for (ColumnDescriptor cd : schema.getColumns()) {
  if (!EnumSet.of(BOOLEAN,INT32,INT64,FLOAT,DOUBLE,BINARY,FIXED_LEN_BYTE_ARRAY).contains(cd.getPrimitiveType().getPrimitiveTypeName())
      && cd.getPrimitiveType().getPrimitiveTypeName() != INT96)
    throw new IllegalStateException("unsupported physical type: " + cd.getPrimitiveType());
}

Try / catch

try {
  df = spark.read.format("iceberg").load("tbl");
} catch (UnsupportedOperationException e) {
  if (e.getMessage().startsWith("Unsupported type:")) {
    // identify column, rewrite or exclude file
  }
}

Prevention

When it happens

Trigger: Reading a Parquet file containing a physical type the reader has no case for (besides the specially handled INT96-as-timestamp compatibility path).

Common situations: Exotic Parquet output from non-standard writers; corrupted column metadata; future Parquet types appearing with older Iceberg versions.

Related errors


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