{"record":{"id":"465c170a8ab30ec0","repo":"apache/iceberg","slug":"not-a-binary-column","errorCode":null,"errorMessage":"Not a binary column","messagePattern":"Not a binary column","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"parquet/src/main/java/org/apache/iceberg/parquet/TripleIterator.java","lineNumber":120,"sourceCode":"   * @return the next value as an un-boxed double\n   * @throws java.util.NoSuchElementException if there are no more elements\n   * @throws UnsupportedOperationException if the underlying data values are not doubles\n   */\n  default double nextDouble() {\n    throw new UnsupportedOperationException(\"Not a double column\");\n  }\n\n  /**\n   * Returns the next value as a Binary.\n   *\n   * <p>This method has the same behavior as {@link #next()} and will advance this iterator.\n   *\n   * @return the next value as a Binary\n   * @throws java.util.NoSuchElementException if there are no more elements\n   * @throws UnsupportedOperationException if the underlying data values are not binary\n   */\n  default Binary nextBinary() {\n    throw new UnsupportedOperationException(\"Not a binary column\");\n  }\n\n  /**\n   * Returns null and advances the iterator.\n   *\n   * <p>This method has the same behavior as {@link #next()} and will advance this iterator.\n   *\n   * @return null\n   * @throws java.util.NoSuchElementException if there are no more elements\n   */\n  <N> N nextNull();\n}\n","sourceCodeStart":102,"sourceCodeEnd":133,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/parquet/src/main/java/org/apache/iceberg/parquet/TripleIterator.java#L102-L133","documentation":"TripleIterator.nextBinary() is a default method that throws UnsupportedOperationException; only iterators for BINARY/FLBA (fixed byte array) columns override it. Receiving this message means the binary accessor was called on a column whose physical type is not binary — the value-reader type dispatch disagrees with the file's column type.","triggerScenarios":"Calling nextBinary() on a TripleIterator whose primitive type is not BINARY/FLBA — e.g. an Iceberg string/uuid column mapped to a numeric physical type, or custom code invoking nextBinary() on an INT32/INT64 column.","commonSituations":"String/UUID columns stored as integers by another writer; Iceberg schema/physical schema divergence (string vs int) after unenforced external rewrites; bespoke ParquetValueReaders dispatching on Iceberg types without checking physical Parquet types.","solutions":["Confirm the column's physical type is BINARY (or FLBA) in the Parquet footer before using nextBinary()","Fix the reader dispatch so string/binary Iceberg types bind to the binary reader for BINARY physical columns","Reconcile the projected Iceberg schema with the actual file schema — a string-typed projection over an int column is invalid","Use the generic next() accessor in custom iterator code when the physical type is uncertain","Rewrite mismatched data files with the correct physical types"],"exampleFix":"// before: binary accessor on a non-binary column\nBinary b = iterator.nextBinary();\n\n// after: guard on physical type\nPrimitiveTypeName p = desc.getPrimitiveType().getPrimitiveTypeName();\nif (p != PrimitiveTypeName.BINARY && p != PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY) {\n  throw new IllegalArgumentException(\"Column \" + desc + \" is not binary\");\n}\nBinary b = iterator.nextBinary();","handlingStrategy":"type-guard","validationCode":"PrimitiveTypeName p = desc.getPrimitiveType().getPrimitiveTypeName();\nif (p != PrimitiveTypeName.BINARY && p != PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY) {\n  throw new IllegalArgumentException(\"Column \" + desc + \" is not binary\");\n}","typeGuard":"boolean isBinaryColumn(ColumnDescriptor desc) {\n  PrimitiveTypeName p = desc.getPrimitiveType().getPrimitiveTypeName();\n  return p == PrimitiveTypeName.BINARY || p == PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY;\n}","tryCatchPattern":"try { b = iterator.nextBinary(); } catch (UnsupportedOperationException e) { throw new IllegalStateException(\"Expected BINARY/FLBA column but got: \" + desc.getPrimitiveType(), e); }","preventionTips":["Bind string/uuid Iceberg types only to BINARY/FLBA physical columns","Verify footer schema vs projection before planning reads; reject type-divergent files early","Use the generic next() accessor in generic code paths","Rewrite data files whose physical types no longer match the declared table schema"],"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"}