apache/iceberg · error · UnsupportedOperationException

Not a float column

Error message

Not a float column

What it means

TripleIterator.nextFloat() is a default method that throws UnsupportedOperationException; only iterators for FLOAT (IEEE single-precision) columns override it. Seeing this message means the float accessor was invoked on a column that is not physically FLOAT — usually a double or decimal column bound to the float reader.

Source

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

   * @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.
   *
   * <p>This method has the same behavior as {@link #next()} and will advance this iterator.
   *
   * @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.
   *

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Verify the column's physical type is FLOAT; if it is DOUBLE, call nextDouble() and cast
  2. Fix the reader dispatch table so float columns bind to the FLOAT reader
  3. Reconcile the Iceberg projected schema (float) with the file schema (double) using proper type promotion
  4. Use the generic next() accessor in custom code when the physical type is unknown
  5. Rewrite divergent data files to match the table's declared schema

Example fix

// before: float accessor on a DOUBLE column
float f = iterator.nextFloat();

// after: dispatch on physical type
float f = desc.getPrimitiveType().getPrimitiveTypeName() == PrimitiveTypeName.FLOAT
    ? iterator.nextFloat()
    : (float) iterator.nextDouble();
Defensive patterns

Strategy: type-guard

Validate before calling

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

Type guard

boolean isFloat32Column(ColumnDescriptor desc) {
  return desc.getPrimitiveType().getPrimitiveTypeName() == PrimitiveTypeName.FLOAT;
}

Try / catch

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

Prevention

When it happens

Trigger: Calling nextFloat() on a TripleIterator whose primitive type is not FLOAT — e.g. an Iceberg float column whose Parquet file stores DOUBLE, or a custom reader dispatching a DOUBLE/decimal column to the float reader.

Common situations: Schema written by another engine stored a float as double; Iceberg projection type (float) disagrees with the physical column type (DOUBLE); hand-written ParquetValueReaders mapping by Iceberg type without checking physical type.

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