apache/iceberg · error · UnsupportedOperationException
Not a long column
Error message
Not a long column
What it means
TripleIterator.nextLong() is a default method that throws UnsupportedOperationException; only iterators for INT64 columns override it. Hitting this message means the long accessor was called on a column that is not physically INT64 — the iterator type dispatch does not match the file's column type.
Source
Thrown at parquet/src/main/java/org/apache/iceberg/parquet/TripleIterator.java:81
* @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.
*
* <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.
*View on GitHub (pinned to 86d9c8fc54)
Solutions
- Check the physical type in the Parquet footer — nextLong() requires INT64; for INT32 data use nextInteger() and widen
- Fix the materializer/reader dispatch so long columns bind to the INT64 reader
- Align the Iceberg schema with the file's physical schema (int vs long promotion must match file content)
- Rewrite non-conforming data files to the table's current schema
- In custom iterator code, verify desc.getPrimitiveType() before calling typed accessors
Example fix
// before: assumes INT64
long ts = iterator.nextLong();
// after: narrow by physical type
long ts = desc.getPrimitiveType().getPrimitiveTypeName() == PrimitiveTypeName.INT64
? iterator.nextLong()
: iterator.nextInteger(); Defensive patterns
Strategy: type-guard
Validate before calling
if (desc.getPrimitiveType().getPrimitiveTypeName() != PrimitiveTypeName.INT64) {
throw new IllegalArgumentException("Column " + desc + " is not INT64");
} Type guard
boolean isInt64Column(ColumnDescriptor desc) {
return desc.getPrimitiveType().getPrimitiveTypeName() == PrimitiveTypeName.INT64;
} Try / catch
try { v = iterator.nextLong(); } catch (UnsupportedOperationException e) { throw new IllegalStateException("Expected INT64 column but got: " + desc.getPrimitiveType(), e); } Prevention
- Handle int-to-long promotion explicitly: read INT32 values via nextInteger() and widen
- Match Iceberg long/timestamp projections to INT64 physical columns only
- Rewrite legacy files (e.g. INT96 timestamps) to the current schema
- Verify reader dispatch tables by physical type in custom code
When it happens
Trigger: Calling nextLong() on a TripleIterator whose primitive type is not INT64 — commonly when an Iceberg long/timestamp column is actually stored as INT32 (date/time as int) or the custom materializer routes the column to the wrong reader.
Common situations: Timestamp columns stored as INT96/millis-as-int in files written by other engines; Iceberg schema upgraded a column from int to long while files still hold INT32 values; bespoke ParquetValueReaders with incorrect type mapping.
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/50a6ca482b525da9.
Report an issue: GitHub.