apache/iceberg · error · UnsupportedOperationException

Not a double column

Error message

Not a double column

What it means

TripleIterator.nextDouble() is a default method that throws UnsupportedOperationException; only iterators for DOUBLE columns override it. The message indicates the double accessor was called on a column that is not physically DOUBLE — the iterator was constructed for a different primitive type.

Source

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

   * @return the next value as an un-boxed float
   * @throws java.util.NoSuchElementException if there are no more elements
   * @throws UnsupportedOperationException if the underlying data values are not floats
   */
  default float nextFloat() {
    throw new UnsupportedOperationException("Not a float column");
  }

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

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

  /**
   * Returns null and advances the iterator.
   *

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Check the physical type in the Parquet footer — nextDouble() requires DOUBLE; for FLOAT use nextFloat() and widen
  2. Correct the reader/materializer dispatch so double columns bind to the DOUBLE reader
  3. Align the Iceberg projection with the file's physical schema (float vs double promotion)
  4. Prefer the generic next() accessor when the physical type may vary
  5. Rewrite data files whose physical types diverge from the declared schema

Example fix

// before: double accessor on a FLOAT column
double d = iterator.nextDouble();

// after: dispatch on physical type
double d = desc.getPrimitiveType().getPrimitiveTypeName() == PrimitiveTypeName.DOUBLE
    ? iterator.nextDouble()
    : iterator.nextFloat();
Defensive patterns

Strategy: type-guard

Validate before calling

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

Type guard

boolean isFloat64Column(ColumnDescriptor desc) {
  return desc.getPrimitiveType().getPrimitiveTypeName() == PrimitiveTypeName.DOUBLE;
}

Try / catch

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

Prevention

When it happens

Trigger: Calling nextDouble() on a TripleIterator whose primitive type is not DOUBLE — e.g. an Iceberg double column stored as FLOAT in the file, or a custom materializer routing a FLOAT/decimal column into the double reader.

Common situations: Files written by another engine using FLOAT for 32-bit real values; schema/projection mismatch where Iceberg declares double but physical type is FLOAT or DECIMAL; custom reader dispatch errors 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/5a8069c14a3b14da. Report an issue: GitHub.