{"record":{"id":"bc35ab269f6f14b9","repo":"prestodb/presto","slug":"column-s-does-not-support-null-value","errorCode":null,"errorMessage":"Column '%s' does not support 'null' value","messagePattern":"Column '(.+?)' does not support 'null' value","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"presto-kafka/src/main/java/com/facebook/presto/kafka/encoder/AbstractRowEncoder.java","lineNumber":122,"sourceCode":"            appendByteBuffer(type.getSlice(block, position).toByteBuffer());\n        }\n        else if (type == DATE) {\n            appendSqlDate((SqlDate) type.getObjectValue(session.getSqlFunctionProperties(), block, position));\n        }\n        else if (type == TIME) {\n            appendSqlTime((SqlTime) type.getObjectValue(session.getSqlFunctionProperties(), block, position));\n        }\n        else if (type == TIME_WITH_TIME_ZONE) {\n            appendSqlTimeWithTimeZone((SqlTimeWithTimeZone) type.getObjectValue(session.getSqlFunctionProperties(), block, position));\n        }\n        else if (type instanceof TimestampType) {\n            appendSqlTimestamp((SqlTimestamp) type.getObjectValue(session.getSqlFunctionProperties(), block, position));\n        }\n        else if (type instanceof TimestampWithTimeZoneType) {\n            appendSqlTimestampWithTimeZone((SqlTimestampWithTimeZone) type.getObjectValue(session.getSqlFunctionProperties(), block, position));\n        }\n        else {\n            throw new UnsupportedOperationException(format(\"Column '%s' does not support 'null' value\", columnHandles.get(currentColumnIndex).getName()));\n        }\n        currentColumnIndex++;\n    }\n\n    // these append value methods should be overridden for each row encoder\n    // only the methods with types supported by the data format should be overridden\n    protected void appendNullValue()\n    {\n        throw new UnsupportedOperationException(format(\"Column '%s' does not support 'null' value\", columnHandles.get(currentColumnIndex).getName()));\n    }\n\n    protected void appendLong(long value)\n    {\n        throw new UnsupportedOperationException(format(\"Unsupported type '%s' for column '%s'\", long.class.getName(), columnHandles.get(currentColumnIndex).getName()));\n    }\n\n    protected void appendInt(int value)\n    {","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-kafka/src/main/java/com/facebook/presto/kafka/encoder/AbstractRowEncoder.java#L104-L140","documentation":"AbstractRowEncoder.appendColumnValue dispatches on the column's type; when a value is null and the type is not one of the supported nullable branches, it falls through to an UnsupportedOperationException saying the column does not support null values. The concrete row encoder never overrode the needed null handling for that type.","triggerScenarios":"INSERT into a Kafka table where a row contains NULL in a column whose type is not handled by the encoder (e.g. writing a null into a column for which appendNullValue path is not supported, or a type branch missing in appendColumnValue).","commonSituations":"Encoding a source table with NULLable columns into Kafka with a format (e.g. Raw/CSV) or type (e.g. some timestamp branches) that cannot represent null; schema change upstream introducing NULLs where none existed before.","solutions":["Remove NULLs from the data: wrap with coalesce(col, default) in the INSERT SELECT","Use an encoder format that supports nulls (e.g. JSON/Avro) instead of Raw","Cast the column to a supported non-null type or a type the encoder handles","Update/patch the row encoder to override appendNullValue for the target format"],"exampleFix":"// before\nINSERT INTO kafka_t SELECT id, note FROM src;  -- note may be NULL\n// after\nINSERT INTO kafka_t SELECT id, coalesce(note, '') FROM src;","handlingStrategy":"validation","validationCode":"// sanitize NULLs before insert\n-- assert no unsupported nulls\nSELECT count(*) FROM src WHERE note IS NULL; -- must be 0 or coalesce first","typeGuard":"null","tryCatchPattern":"try { insert(); } catch (UnsupportedOperationException e) {\n  if (e.getMessage().contains(\"does not support 'null' value\")) {\n    // coalesce offending column and retry insert\n  }\n}","preventionTips":["Always coalesce nullable source columns before Kafka INSERT","Match encoder format to data nullability (Raw cannot hold nulls)","Test inserts with NULL-containing sample data","Track which types each row encoder supports"],"tags":["kafka","encoder","null-value","presto-connector"],"backgroundTag":"unsupported-null-column-value","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}