prestodb/presto · error · UnsupportedOperationException
Unsupported type '%s' for column '%s'
Error message
Unsupported type '%s' for column '%s'
What it means
AbstractRowEncoder is a template base class for Kafka row encoders. Each concrete encoder (JSON, CSV, Avro, Raw) overrides only the append* methods for the primitive types its data format supports; this default appendLong body is the unsupported fallback. It throws when a row is being encoded and a BIGINT column value reaches an encoder that did not override appendLong, meaning the chosen encoder cannot represent that column type.
Source
Thrown at presto-kafka/src/main/java/com/facebook/presto/kafka/encoder/AbstractRowEncoder.java:136
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)
{
throw new UnsupportedOperationException(format("Unsupported type '%s' for column '%s'", int.class.getName(), columnHandles.get(currentColumnIndex).getName()));
}
protected void appendShort(short value)
{
throw new UnsupportedOperationException(format("Unsupported type '%s' for column '%s'", short.class.getName(), columnHandles.get(currentColumnIndex).getName()));
}
protected void appendByte(byte value)
{
throw new UnsupportedOperationException(format("Unsupported type '%s' for column '%s'", byte.class.getName(), columnHandles.get(currentColumnIndex).getName()));
}
protected void appendDouble(double value)View on GitHub (pinned to 55bb57d202)
Solutions
- Remove the BIGINT column from the topic's column list, or cast it to VARCHAR in the query (e.g. CAST(col AS VARCHAR)) so appendLong is never dispatched.
- Change the topic's encoder data_format in the topic description file to one that supports BIGINT (e.g. 'json' or 'avro' instead of 'raw').
- If writing a custom encoder, override appendLong(long) in your AbstractRowEncoder subclass to handle BIGINT values.
Example fix
// before: RawEncoder with a BIGINT column CREATE TABLE kafka_news WITH (topic='events', data_format='raw', columns=[... 'seq' BIGINT ...]) ... // after: cast the BIGINT column to VARCHAR in the topic definition 'seq' VARCHAR -- or query with CAST(seq AS VARCHAR)
Defensive patterns
Strategy: validation
Validate before calling
// Before writing, verify the encoder supports BIGINT columns:
for (EncoderColumnHandle col : columnHandles) {
if (col.getType().equals(BigintType.BIGINT)) {
throw new IllegalArgumentException("Encoder data_format for topic " + topicName
+ " does not support BIGINT column " + col.getName());
}
} Try / catch
// At INSERT time, wrap row encoding so the message names the offending column:
try {
rowEncoder.appendColumnValue(block, position);
}
catch (UnsupportedOperationException e) {
throw new PrestoException(KafkaErrorCode.KAFKA_ENCODER_ERROR, e.getMessage()
+ "; check that data_format='" + dataFormat + "' supports the declared column types", e);
} Prevention
- Keep the topic description's column list aligned with what the chosen data_format can encode.
- Prefer 'json' or 'avro' data_format for topics with numeric (BIGINT) columns.
- Before switching a topic to 'raw' format, drop or cast all non-varchar columns.
- Cast unsupported column types in the SELECT/INSERT statement (CAST(col AS VARCHAR)).
When it happens
Trigger: appendColumnValue (AbstractRowEncoder.java:82-83) dispatches to appendLong when the EncoderColumnHandle's type is BigintType.BIGINT and the block value is non-null, and the concrete row encoder subclass has not overridden appendLong.
Common situations: A Kafka topic definition (etc/kafka.properties topic description) declares a column of type BIGINT but the encoder configured for the topic (e.g. RawEncoder, which supports only bytes/varchar, or CSV encoder with limited type support) cannot encode BIGINT. Also happens when switching a topic's data_format from JSON/Avro to 'raw' without dropping BIGINT columns from the column list.
Related errors
- SingleMapBlock does not support appendNull()
- SingleRowBlock does not support appendNull()
- KdbTree type cannot be serialized
- fieldType.getTypeSignature() + " type is not orderable"
- Precision not supported
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/1ec4e52d413231c5.
Report an issue: GitHub.