apache/iceberg · error · UnsupportedOperationException

Not a boolean column

Error message

Not a boolean column

What it means

TripleIterator.nextBoolean() is a default method on the page-level column iterator interface that intentionally throws UnsupportedOperationException; only concrete iterators for boolean columns (e.g. PageIterator built for BOOLEAN_LE/BOOLEAN physical types) override it. Hitting this message means a typed accessor was called on an iterator whose underlying Parquet column is not a boolean — an internal type-dispatch bug, not a user data error.

Source

Thrown at parquet/src/main/java/org/apache/iceberg/parquet/TripleIterator.java:55

   *
   * <p>This method does not advance this iterator.
   *
   * @return the repetition level of the current triple, or 0 if there is no current triple.
   * @throws java.util.NoSuchElementException if there are no more elements
   */
  int currentRepetitionLevel();

  /**
   * Returns the next value as an un-boxed boolean.
   *
   * <p>This method has the same behavior as {@link #next()} and will advance this iterator.
   *
   * @return the next value as an un-boxed boolean
   * @throws java.util.NoSuchElementException if there are no more elements
   * @throws UnsupportedOperationException if the underlying data values are not booleans
   */
  default boolean nextBoolean() {
    throw new UnsupportedOperationException("Not a boolean column");
  }

  /**
   * Returns the next value as an un-boxed int.
   *
   * <p>This method has the same behavior as {@link #next()} and will advance this iterator.
   *
   * @return the next value as an un-boxed int
   * @throws java.util.NoSuchElementException if there are no more elements
   * @throws UnsupportedOperationException if the underlying data values are not ints
   */
  default int nextInteger() {
    throw new UnsupportedOperationException("Not an integer column");
  }

  /**
   * Returns the next value as an un-boxed long.
   *

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Check the reader/materializer dispatch for that column: the Iceberg type must map to Parquet BOOLEAN for nextBoolean()
  2. Verify the projected Iceberg schema matches the actual file schema (types were not altered/renamed)
  3. Do not call nextBoolean() directly on a TripleIterator unless its ColumnDescriptor primitive type is BOOLEAN
  4. Update to a recent Iceberg version if a bundled type-mapping bug dispatched the wrong reader
  5. For custom ParquetValueReaders, use TripleIterator.next()/a correctly typed reader instead of hard-coding the accessor

Example fix

// before: boolean reader bound to a non-boolean column
case INT: return new IntegerReader(...); // wrong dispatch

// after: dispatch on the physical primitive type
case BOOLEAN: return new BooleanReader(desc);
case INT32: return new IntegerReader(desc);
Defensive patterns

Strategy: type-guard

Validate before calling

if (desc.getPrimitiveType().getPrimitiveTypeName() != PrimitiveTypeName.BOOLEAN) {
  throw new IllegalArgumentException("Column " + desc + " is not BOOLEAN");
}

Type guard

boolean isBooleanColumn(ColumnDescriptor desc) {
  return desc.getPrimitiveType().getPrimitiveTypeName() == PrimitiveTypeName.BOOLEAN;
}

Try / catch

try { v = iterator.nextBoolean(); } catch (UnsupportedOperationException e) { throw new IllegalStateException("Reader/column type dispatch mismatch: " + desc, e); }

Prevention

When it happens

Trigger: Calling nextBoolean() on a TripleIterator whose column descriptor's primitive type is not BOOLEAN, e.g. a custom ParquetValueReader or materializer that dispatches on the wrong Iceberg type id so a non-boolean column routes to the boolean reader.

Common situations: Custom read type converters (GenericParquetReaders / user-supplied ParquetValueReaders) mapping an Iceberg type to the wrong physical Parquet type; schema mismatch between the Iceberg projection and the actual file schema after an unenforced type promotion; bespoke column iterators in extension code.

Understand the failure class

Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.

Related errors


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