apache/iceberg · error · UnsupportedOperationException

Not a boolean column

Error message

Not a boolean column

What it means

TripleWriter is a visitor interface for writing a single Parquet column's values (repetition level, definition level, value). Each writeX method has a default implementation that throws UnsupportedOperationException, so calling writeBoolean on a writer whose column is not a BOOLEAN physical type fails. The concrete writer for a boolean column overrides writeBoolean; other writers leave the default throwing body in place.

Source

Thrown at parquet/src/main/java/org/apache/iceberg/parquet/TripleWriter.java:41

public interface TripleWriter<T> {
  // TODO: should definition level be included, or should it be part of the column?

  /**
   * Write a value.
   *
   * @param rl repetition level
   * @param value the value
   */
  void write(int rl, T value);

  /**
   * Write a triple.
   *
   * @param rl repetition level
   * @param value the boolean value
   */
  default void writeBoolean(int rl, boolean value) {
    throw new UnsupportedOperationException("Not a boolean column");
  }

  /**
   * Write a triple.
   *
   * @param rl repetition level
   * @param value the integer value
   */
  default void writeInteger(int rl, int value) {
    throw new UnsupportedOperationException("Not an integer column");
  }

  /**
   * Write a triple.
   *
   * @param rl repetition level
   * @param value the long value
   */

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Verify the Parquet column type is BOOLEAN (primitive().getPrimitiveTypeName() == BOOLEAN) before calling writeBoolean.
  2. If implementing a TripleWriter for a boolean column, override writeBoolean instead of relying on the default.
  3. Check that the Iceberg-to-Parquet type mapping (TypeToMessageType) generated the expected physical type for the schema field.

Example fix

// before
writer.writeBoolean(rl, value); // column is INT32 -> UnsupportedOperationException
// after
if (writer.getClass() == BooleanColumnWriter.class) {
  writer.writeBoolean(rl, value);
}
Defensive patterns

Strategy: type-guard

Validate before calling

boolean isBooleanColumn(TripleWriter<?> w, ColumnDescriptor col) {
  return col.getPrimitiveType().getPrimitiveTypeName() == org.apache.parquet.schema.PrimitiveType.PrimitiveTypeName.BOOLEAN;
}

Type guard

if (col.getPrimitiveType().getPrimitiveTypeName() == PrimitiveTypeName.BOOLEAN) { writer.writeBoolean(rl, value); }

Prevention

When it happens

Trigger: Calling column.writeBoolean(rl, value) on a TripleWriter instance whose underlying Parquet column is not of BOOLEAN type (e.g. an INT32 or BINARY column writer).

Common situations: A schema/type mismatch between the Iceberg type and the Parquet physical type dispatched during data-file writes; a custom TripleWriter implementation that forgot to override writeBoolean for a boolean column; misordered visitor dispatch so the wrong writer handles the value.

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/4d0e810a11c6483f. Report an issue: GitHub.