{"record":{"id":"cce157291bd61c59","repo":"apache/iceberg","slug":"not-an-integer-column","errorCode":null,"errorMessage":"Not an integer column","messagePattern":"Not an integer column","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"parquet/src/main/java/org/apache/iceberg/parquet/TripleIterator.java","lineNumber":68,"sourceCode":"   * @return the next value as an un-boxed boolean\n   * @throws java.util.NoSuchElementException if there are no more elements\n   * @throws UnsupportedOperationException if the underlying data values are not booleans\n   */\n  default boolean nextBoolean() {\n    throw new UnsupportedOperationException(\"Not a boolean column\");\n  }\n\n  /**\n   * Returns the next value as an un-boxed int.\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 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   *","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/parquet/src/main/java/org/apache/iceberg/parquet/TripleIterator.java#L50-L86","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Confirm the column's physical Parquet type (ParquetFileReader footer) is INT32 before expecting nextInteger() to work","Fix the reader dispatch so int columns route to the INT32 reader (IntegerReader/intsReader)","Reconcile the Iceberg projected schema with the file's real schema (e.g. long vs int) and promote the schema correctly","Use next()/the generic accessor in custom code instead of assuming the primitive type","Regenerate/re-write data files whose physical schema diverged from the table schema"],"exampleFix":"// before: assumes int regardless of physical type\nint v = iterator.nextInteger();\n\n// after: guard on the column descriptor's primitive type\nif (desc.getPrimitiveType().getPrimitiveTypeName() != PrimitiveTypeName.INT32) {\n  throw new IllegalArgumentException(\"Column \" + desc + \" is not INT32\");\n}\nint v = iterator.nextInteger();","handlingStrategy":"type-guard","validationCode":"if (desc.getPrimitiveType().getPrimitiveTypeName() != PrimitiveTypeName.INT32) {\n  throw new IllegalArgumentException(\"Column \" + desc + \" is not INT32\");\n}","typeGuard":"boolean isInt32Column(ColumnDescriptor desc) {\n  return desc.getPrimitiveType().getPrimitiveTypeName() == PrimitiveTypeName.INT32;\n}","tryCatchPattern":"try { v = iterator.nextInteger(); } catch (UnsupportedOperationException e) { throw new IllegalStateException(\"Expected INT32 column but got: \" + desc.getPrimitiveType(), e); }","preventionTips":["Check the Parquet footer's physical types against the Iceberg projection before reading","Map Iceberg int/date columns only to INT32 physical columns","Use the generic next() accessor when physical type is unknown","Unit-test custom readers against files with divergent physical schemas"],"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"}