prestodb/presto · error · PrestoException

DECODER_CONVERSION_NOT_SUPPORTED

DECODER_CONVERSION_NOT_SUPPORTED

Error message

start offset %s for column '%s' must be less that or equal to value length %s

What it means

RawColumnDecoder.decodeField slices raw record bytes at [start, end). If the configured start offset exceeds the actual byte length of the record's value, there is nothing to decode, so it throws PrestoException(DECODER_CONVERSION_NOT_SUPPORTED, "start offset %s for column '%s' must be less that or equal to value length %s") at query time for the offending row.

Source

Thrown at presto-record-decoder/src/main/java/com/facebook/presto/decoder/raw/RawColumnDecoder.java:191

    {
        if (!Arrays.asList(allowedFieldTypes).contains(declaredFieldType)) {
            throw new IllegalArgumentException(format(
                    "Wrong dataFormat '%s' specified for column '%s'; %s type implies use of %s",
                    declaredFieldType.name(),
                    columnName,
                    columnType.getDisplayName(),
                    Joiner.on("/").join(allowedFieldTypes)));
        }
    }

    public FieldValueProvider decodeField(byte[] value)
    {
        requireNonNull(value, "value is null");

        int actualEnd = end.orElse(value.length);

        if (start > value.length) {
            throw new PrestoException(DECODER_CONVERSION_NOT_SUPPORTED, format(
                    "start offset %s for column '%s' must be less that or equal to value length %s",
                    start,
                    columnName,
                    value.length));
        }

        if (actualEnd > value.length) {
            throw new PrestoException(DECODER_CONVERSION_NOT_SUPPORTED, format(
                    "end offset %s for column '%s' must be less that or equal to value length %s",
                    actualEnd,
                    columnName,
                    value.length));
        }
        return new RawValueProvider(ByteBuffer.wrap(value, start, actualEnd - start), fieldType, columnName, columnType);
    }

    private static class RawValueProvider
            extends FieldValueProvider

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Lower the column mapping offsets so they fit within the minimum message size, or lengthen/validate producer messages.
  2. Version your tables: point a new table definition at the new message layout and query per version.
  3. Filter out short/legacy records before decoding (e.g. via a key or header column) or fix them upstream.
  4. If the column is nullable/optional for short rows, decode it as VARCHAR with a range within the common prefix, or preprocess with a stream job.

Example fix

// before: mapping assumes >= 100-byte messages, but short records exist
-- extra BIGINT WITH (data_format='LONG', mapping='100:108')
// after: offsets within the guaranteed minimum record size
-- extra BIGINT WITH (data_format='LONG', mapping='32:40')
Defensive patterns

Strategy: validation

Validate before calling

void checkOffsetsFit(int start, int end, byte[] value) {
  if (start > value.length)
    throw new IllegalArgumentException("start " + start + " exceeds record length " + value.length);
}

Try / catch

try (ResultSet rs = stmt.executeQuery(sql)) { ... } catch (SQLException e) { if (e.getMessage().contains("must be less that or equal to value length")) { auditShortRecords(); } else throw e; }

Prevention

When it happens

Trigger: A query reads a raw-decoder column whose mapping start (e.g. '100:110') is larger than the current record's value length (e.g. 42 bytes); thrown from decodeField per-row while scanning, so one short message poisons the scan.

Common situations: Variable-length producer messages where some records are shorter than the assumed fixed layout; mapping offsets written for a different schema/version; compacted or truncated messages in the topic.

Related errors


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