{"record":{"id":"4d0e810a11c6483f","repo":"apache/iceberg","slug":"not-a-boolean-column-4d0e81","errorCode":null,"errorMessage":"Not a boolean column","messagePattern":"Not a boolean column","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"parquet/src/main/java/org/apache/iceberg/parquet/TripleWriter.java","lineNumber":41,"sourceCode":"public interface TripleWriter<T> {\n  // TODO: should definition level be included, or should it be part of the column?\n\n  /**\n   * Write a value.\n   *\n   * @param rl repetition level\n   * @param value the value\n   */\n  void write(int rl, T value);\n\n  /**\n   * Write a triple.\n   *\n   * @param rl repetition level\n   * @param value the boolean value\n   */\n  default void writeBoolean(int rl, boolean value) {\n    throw new UnsupportedOperationException(\"Not a boolean column\");\n  }\n\n  /**\n   * Write a triple.\n   *\n   * @param rl repetition level\n   * @param value the integer value\n   */\n  default void writeInteger(int rl, int value) {\n    throw new UnsupportedOperationException(\"Not an integer column\");\n  }\n\n  /**\n   * Write a triple.\n   *\n   * @param rl repetition level\n   * @param value the long value\n   */","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/parquet/src/main/java/org/apache/iceberg/parquet/TripleWriter.java#L23-L59","documentation":"TripleWriter is a visitor interface for writing a single Parquet column's values (repetition level, definition level, value). Each writeX method has a default implementation that throws UnsupportedOperationException, so calling writeBoolean on a writer whose column is not a BOOLEAN physical type fails. The concrete writer for a boolean column overrides writeBoolean; other writers leave the default throwing body in place.","triggerScenarios":"Calling column.writeBoolean(rl, value) on a TripleWriter instance whose underlying Parquet column is not of BOOLEAN type (e.g. an INT32 or BINARY column writer).","commonSituations":"A schema/type mismatch between the Iceberg type and the Parquet physical type dispatched during data-file writes; a custom TripleWriter implementation that forgot to override writeBoolean for a boolean column; misordered visitor dispatch so the wrong writer handles the value.","solutions":["Verify the Parquet column type is BOOLEAN (primitive().getPrimitiveTypeName() == BOOLEAN) before calling writeBoolean.","If implementing a TripleWriter for a boolean column, override writeBoolean instead of relying on the default.","Check that the Iceberg-to-Parquet type mapping (TypeToMessageType) generated the expected physical type for the schema field."],"exampleFix":"// before\nwriter.writeBoolean(rl, value); // column is INT32 -> UnsupportedOperationException\n// after\nif (writer.getClass() == BooleanColumnWriter.class) {\n  writer.writeBoolean(rl, value);\n}","handlingStrategy":"type-guard","validationCode":"boolean isBooleanColumn(TripleWriter<?> w, ColumnDescriptor col) {\n  return col.getPrimitiveType().getPrimitiveTypeName() == org.apache.parquet.schema.PrimitiveType.PrimitiveTypeName.BOOLEAN;\n}","typeGuard":"if (col.getPrimitiveType().getPrimitiveTypeName() == PrimitiveTypeName.BOOLEAN) { writer.writeBoolean(rl, value); }","tryCatchPattern":null,"preventionTips":["Check the ColumnDescriptor's physical type before each typed write call.","Keep one TripleWriter subclass per physical type and dispatch via a switch on the type name.","Unit-test writer dispatch for every Iceberg type in your schema."],"tags":["parquet","unsupported-type","writer"],"backgroundTag":"unsupported-operation","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T21:17:11.552Z"}