{"record":{"id":"1ec4e52d413231c5","repo":"prestodb/presto","slug":"unsupported-type-s-for-column-s","errorCode":null,"errorMessage":"Unsupported type '%s' for column '%s'","messagePattern":"Unsupported type '(.+?)' for column '(.+?)'","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"presto-kafka/src/main/java/com/facebook/presto/kafka/encoder/AbstractRowEncoder.java","lineNumber":136,"sourceCode":"        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    {\n        throw new UnsupportedOperationException(format(\"Unsupported type '%s' for column '%s'\", int.class.getName(), columnHandles.get(currentColumnIndex).getName()));\n    }\n\n    protected void appendShort(short value)\n    {\n        throw new UnsupportedOperationException(format(\"Unsupported type '%s' for column '%s'\", short.class.getName(), columnHandles.get(currentColumnIndex).getName()));\n    }\n\n    protected void appendByte(byte value)\n    {\n        throw new UnsupportedOperationException(format(\"Unsupported type '%s' for column '%s'\", byte.class.getName(), columnHandles.get(currentColumnIndex).getName()));\n    }\n\n    protected void appendDouble(double value)","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-kafka/src/main/java/com/facebook/presto/kafka/encoder/AbstractRowEncoder.java#L118-L154","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before: RawEncoder with a BIGINT column\nCREATE TABLE kafka_news WITH (topic='events', data_format='raw', columns=[... 'seq' BIGINT ...]) ...\n// after: cast the BIGINT column to VARCHAR in the topic definition\n'seq' VARCHAR  -- or query with CAST(seq AS VARCHAR)","handlingStrategy":"validation","validationCode":"// Before writing, verify the encoder supports BIGINT columns:\nfor (EncoderColumnHandle col : columnHandles) {\n    if (col.getType().equals(BigintType.BIGINT)) {\n        throw new IllegalArgumentException(\"Encoder data_format for topic \" + topicName\n            + \" does not support BIGINT column \" + col.getName());\n    }\n}","typeGuard":null,"tryCatchPattern":"// At INSERT time, wrap row encoding so the message names the offending column:\ntry {\n    rowEncoder.appendColumnValue(block, position);\n}\ncatch (UnsupportedOperationException e) {\n    throw new PrestoException(KafkaErrorCode.KAFKA_ENCODER_ERROR, e.getMessage()\n        + \"; check that data_format='\" + dataFormat + \"' supports the declared column types\", e);\n}","preventionTips":["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))."],"tags":["presto-kafka","kafka-encoder","unsupported-operation","bigint"],"backgroundTag":"unsupported-column-type","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"}