{"record":{"id":"50a6ca482b525da9","repo":"apache/iceberg","slug":"not-a-long-column","errorCode":null,"errorMessage":"Not a long column","messagePattern":"Not a long column","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"parquet/src/main/java/org/apache/iceberg/parquet/TripleIterator.java","lineNumber":81,"sourceCode":"   * @return the next value as an un-boxed int\n   * @throws java.util.NoSuchElementException if there are no more elements\n   * @throws UnsupportedOperationException if the underlying data values are not ints\n   */\n  default int nextInteger() {\n    throw new UnsupportedOperationException(\"Not an integer column\");\n  }\n\n  /**\n   * Returns the next value as an un-boxed long.\n   *\n   * <p>This method has the same behavior as {@link #next()} and will advance this iterator.\n   *\n   * @return the next value as an un-boxed long\n   * @throws java.util.NoSuchElementException if there are no more elements\n   * @throws UnsupportedOperationException if the underlying data values are not longs\n   */\n  default long nextLong() {\n    throw new UnsupportedOperationException(\"Not a long column\");\n  }\n\n  /**\n   * Returns the next value as an un-boxed float.\n   *\n   * <p>This method has the same behavior as {@link #next()} and will advance this iterator.\n   *\n   * @return the next value as an un-boxed float\n   * @throws java.util.NoSuchElementException if there are no more elements\n   * @throws UnsupportedOperationException if the underlying data values are not floats\n   */\n  default float nextFloat() {\n    throw new UnsupportedOperationException(\"Not a float column\");\n  }\n\n  /**\n   * Returns the next value as an un-boxed double.\n   *","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/parquet/src/main/java/org/apache/iceberg/parquet/TripleIterator.java#L63-L99","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before: assumes INT64\nlong ts = iterator.nextLong();\n\n// after: narrow by physical type\nlong ts = desc.getPrimitiveType().getPrimitiveTypeName() == PrimitiveTypeName.INT64\n    ? iterator.nextLong()\n    : iterator.nextInteger();","handlingStrategy":"type-guard","validationCode":"if (desc.getPrimitiveType().getPrimitiveTypeName() != PrimitiveTypeName.INT64) {\n  throw new IllegalArgumentException(\"Column \" + desc + \" is not INT64\");\n}","typeGuard":"boolean isInt64Column(ColumnDescriptor desc) {\n  return desc.getPrimitiveType().getPrimitiveTypeName() == PrimitiveTypeName.INT64;\n}","tryCatchPattern":"try { v = iterator.nextLong(); } catch (UnsupportedOperationException e) { throw new IllegalStateException(\"Expected INT64 column but got: \" + desc.getPrimitiveType(), e); }","preventionTips":["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"],"tags":["parquet","type-mismatch","column-iterator"],"backgroundTag":"type-mismatch","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}