prestodb/presto · error · UnsupportedOperationException

Column '%s' does not support 'null' value

Error message

Column '%s' does not support 'null' value

What it means

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.

Source

Thrown at presto-kafka/src/main/java/com/facebook/presto/kafka/encoder/AbstractRowEncoder.java:122

            appendByteBuffer(type.getSlice(block, position).toByteBuffer());
        }
        else if (type == DATE) {
            appendSqlDate((SqlDate) type.getObjectValue(session.getSqlFunctionProperties(), block, position));
        }
        else if (type == TIME) {
            appendSqlTime((SqlTime) type.getObjectValue(session.getSqlFunctionProperties(), block, position));
        }
        else if (type == TIME_WITH_TIME_ZONE) {
            appendSqlTimeWithTimeZone((SqlTimeWithTimeZone) type.getObjectValue(session.getSqlFunctionProperties(), block, position));
        }
        else if (type instanceof TimestampType) {
            appendSqlTimestamp((SqlTimestamp) type.getObjectValue(session.getSqlFunctionProperties(), block, position));
        }
        else if (type instanceof TimestampWithTimeZoneType) {
            appendSqlTimestampWithTimeZone((SqlTimestampWithTimeZone) type.getObjectValue(session.getSqlFunctionProperties(), block, position));
        }
        else {
            throw new UnsupportedOperationException(format("Column '%s' does not support 'null' value", columnHandles.get(currentColumnIndex).getName()));
        }
        currentColumnIndex++;
    }

    // these append value methods should be overridden for each row encoder
    // only the methods with types supported by the data format should be overridden
    protected void appendNullValue()
    {
        throw new UnsupportedOperationException(format("Column '%s' does not support 'null' value", columnHandles.get(currentColumnIndex).getName()));
    }

    protected void appendLong(long value)
    {
        throw new UnsupportedOperationException(format("Unsupported type '%s' for column '%s'", long.class.getName(), columnHandles.get(currentColumnIndex).getName()));
    }

    protected void appendInt(int value)
    {

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Remove NULLs from the data: wrap with coalesce(col, default) in the INSERT SELECT
  2. Use an encoder format that supports nulls (e.g. JSON/Avro) instead of Raw
  3. Cast the column to a supported non-null type or a type the encoder handles
  4. Update/patch the row encoder to override appendNullValue for the target format

Example fix

// before
INSERT INTO kafka_t SELECT id, note FROM src;  -- note may be NULL
// after
INSERT INTO kafka_t SELECT id, coalesce(note, '') FROM src;
Defensive patterns

Strategy: validation

Validate before calling

// sanitize NULLs before insert
-- assert no unsupported nulls
SELECT count(*) FROM src WHERE note IS NULL; -- must be 0 or coalesce first

Type guard

null

Try / catch

try { insert(); } catch (UnsupportedOperationException e) {
  if (e.getMessage().contains("does not support 'null' value")) {
    // coalesce offending column and retry insert
  }
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/bc35ab269f6f14b9. Report an issue: GitHub.