prestodb/presto · error · PrestoException

DECODER_CONVERSION_NOT_SUPPORTED

DECODER_CONVERSION_NOT_SUPPORTED

Error message

could not parse value '%s' as '%s' for column '%s'

What it means

In CsvColumnDecoder's boolean field getter, the token is parsed with Boolean.parseBoolean but the catch is written for NumberFormatException, and DECODER_CONVERSION_NOT_SUPPORTED is thrown when the token cannot be handled as a boolean for the column. Practically this fires when the CSV value is not a parseable boolean-formatted token for the column's declared type.

Source

Thrown at presto-record-decoder/src/main/java/com/facebook/presto/decoder/csv/CsvColumnDecoder.java:104

        }
        else {
            return new FieldValueProvider()
            {
                @Override
                public boolean isNull()
                {
                    return tokens[columnIndex].isEmpty();
                }

                @SuppressWarnings("SimplifiableConditionalExpression")
                @Override
                public boolean getBoolean()
                {
                    try {
                        return Boolean.parseBoolean(tokens[columnIndex].trim());
                    }
                    catch (NumberFormatException e) {
                        throw new PrestoException(DECODER_CONVERSION_NOT_SUPPORTED, format("could not parse value '%s' as '%s' for column '%s'", tokens[columnIndex].trim(), columnType, columnName));
                    }
                }

                @Override
                public long getLong()
                {
                    try {
                        return Long.parseLong(tokens[columnIndex].trim());
                    }
                    catch (NumberFormatException e) {
                        throw new PrestoException(DECODER_CONVERSION_NOT_SUPPORTED, format("could not parse value '%s' as '%s' for column '%s'", tokens[columnIndex].trim(), columnType, columnName));
                    }
                }

                @Override
                public double getDouble()
                {
                    try {

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Ensure the CSV values are literal 'true' or 'false' (case-insensitive), which Boolean.parseBoolean accepts
  2. Remap or retype the column if the data uses 1/0 or yes/no; preprocess or normalize the source data
  3. Verify the column's declared type matches the actual data type in the CSV
  4. Check that columnIndex points at the intended field so the right token is being parsed

Example fix

// before
{"name": "is_active", "type": "boolean", "mapping": "2"}   // CSV value: 'Y'
// after: normalize data to 'true'/'false', or read as varchar and cast
SELECT cast(is_active_raw = 'Y' as boolean) FROM t
Defensive patterns

Strategy: validation

Validate before calling

boolean isParsableBoolean(String token) {
    return token != null && (token.trim().equalsIgnoreCase("true") || token.trim().equalsIgnoreCase("false"));
}

Try / catch

try { row.getBoolean(fieldName); }
catch (PrestoException e) {
    if (e.getErrorCode().getName().equals("DECODER_CONVERSION_NOT_SUPPORTED")) {
        log.warn("Bad boolean token in column {}", fieldName); return null; // or route to error stream
    }
    throw e;
}

Prevention

When it happens

Trigger: getBoolean() called on a CSV token that fails conversion for the column type; token is an empty string after trim (ArrayIndexOutOfBounds/empty handled upstream but empty tokens here trip the conversion path); the catch's NumberFormatException never matches parseBoolean, so unexpected parse failures surface through this or related paths.

Common situations: CSV column declared as boolean but data contains 'yes'/'no', '1'/'0', or 'Y'/'N'; empty cells for required boolean fields; mismatch between declared column type and actual CSV contents.

Related errors


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