apache/iceberg · error · UnsupportedOperationException

Not an integer column

Error message

Not an integer column

What it means

TripleIterator.nextInteger() is a default method that throws UnsupportedOperationException; only iterators for INT32 columns override it. Receiving this message means the typed int accessor was invoked on a column whose Parquet physical type is not INT32 — a type-dispatch inconsistency between the value reader and the file's column type.

Source

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

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

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

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Confirm the column's physical Parquet type (ParquetFileReader footer) is INT32 before expecting nextInteger() to work
  2. Fix the reader dispatch so int columns route to the INT32 reader (IntegerReader/intsReader)
  3. Reconcile the Iceberg projected schema with the file's real schema (e.g. long vs int) and promote the schema correctly
  4. Use next()/the generic accessor in custom code instead of assuming the primitive type
  5. Regenerate/re-write data files whose physical schema diverged from the table schema

Example fix

// before: assumes int regardless of physical type
int v = iterator.nextInteger();

// after: guard on the column descriptor's primitive type
if (desc.getPrimitiveType().getPrimitiveTypeName() != PrimitiveTypeName.INT32) {
  throw new IllegalArgumentException("Column " + desc + " is not INT32");
}
int v = iterator.nextInteger();
Defensive patterns

Strategy: type-guard

Validate before calling

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

Type guard

boolean isInt32Column(ColumnDescriptor desc) {
  return desc.getPrimitiveType().getPrimitiveTypeName() == PrimitiveTypeName.INT32;
}

Try / catch

try { v = iterator.nextInteger(); } catch (UnsupportedOperationException e) { throw new IllegalStateException("Expected INT32 column but got: " + desc.getPrimitiveType(), e); }

Prevention

When it happens

Trigger: Calling nextInteger() on a TripleIterator whose ColumnDescriptor primitive type is not INT32 — e.g. a materializer mapping an Iceberg int/long/date column to the wrong physical type, or custom code invoking the accessor on a binary/int96 column.

Common situations: Iceberg schema declares an int but the Parquet file stores the column as long (INT64) after an out-of-band rewrite; custom ParquetValueReaders dispatch tables built off the wrong TypeDescription; reading a file whose physical schema diverges from the projection.

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