{"record":{"id":"3425827f87c68023","repo":"prestodb/presto","slug":"decoder-conversion-not-supported-342582","errorCode":"DECODER_CONVERSION_NOT_SUPPORTED","errorMessage":"could not parse value '%s' as '%s' for column '%s'","messagePattern":"could not parse value '(.+?)' as '(.+?)' for column '(.+?)'","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-record-decoder/src/main/java/com/facebook/presto/decoder/csv/CsvColumnDecoder.java","lineNumber":104,"sourceCode":"        }\n        else {\n            return new FieldValueProvider()\n            {\n                @Override\n                public boolean isNull()\n                {\n                    return tokens[columnIndex].isEmpty();\n                }\n\n                @SuppressWarnings(\"SimplifiableConditionalExpression\")\n                @Override\n                public boolean getBoolean()\n                {\n                    try {\n                        return Boolean.parseBoolean(tokens[columnIndex].trim());\n                    }\n                    catch (NumberFormatException e) {\n                        throw new PrestoException(DECODER_CONVERSION_NOT_SUPPORTED, format(\"could not parse value '%s' as '%s' for column '%s'\", tokens[columnIndex].trim(), columnType, columnName));\n                    }\n                }\n\n                @Override\n                public long getLong()\n                {\n                    try {\n                        return Long.parseLong(tokens[columnIndex].trim());\n                    }\n                    catch (NumberFormatException e) {\n                        throw new PrestoException(DECODER_CONVERSION_NOT_SUPPORTED, format(\"could not parse value '%s' as '%s' for column '%s'\", tokens[columnIndex].trim(), columnType, columnName));\n                    }\n                }\n\n                @Override\n                public double getDouble()\n                {\n                    try {","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-record-decoder/src/main/java/com/facebook/presto/decoder/csv/CsvColumnDecoder.java#L86-L122","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Ensure the CSV values are literal 'true' or 'false' (case-insensitive), which Boolean.parseBoolean accepts","Remap or retype the column if the data uses 1/0 or yes/no; preprocess or normalize the source data","Verify the column's declared type matches the actual data type in the CSV","Check that columnIndex points at the intended field so the right token is being parsed"],"exampleFix":"// before\n{\"name\": \"is_active\", \"type\": \"boolean\", \"mapping\": \"2\"}   // CSV value: 'Y'\n// after: normalize data to 'true'/'false', or read as varchar and cast\nSELECT cast(is_active_raw = 'Y' as boolean) FROM t","handlingStrategy":"validation","validationCode":"boolean isParsableBoolean(String token) {\n    return token != null && (token.trim().equalsIgnoreCase(\"true\") || token.trim().equalsIgnoreCase(\"false\"));\n}","typeGuard":null,"tryCatchPattern":"try { row.getBoolean(fieldName); }\ncatch (PrestoException e) {\n    if (e.getErrorCode().getName().equals(\"DECODER_CONVERSION_NOT_SUPPORTED\")) {\n        log.warn(\"Bad boolean token in column {}\", fieldName); return null; // or route to error stream\n    }\n    throw e;\n}","preventionTips":["Keep boolean CSV data strictly as true/false","Match declared column types to actual data during onboarding","Spot-check sample rows against the schema before deploying queries"],"tags":["csv","decoding","type-conversion","boolean"],"backgroundTag":"csv-value-parse-failure","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"}