{"record":{"id":"6550731937080bcd","repo":"prestodb/presto","slug":"decoder-conversion-not-supported-655073","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/json/AbstractDateTimeJsonValueProvider.java","lineNumber":60,"sourceCode":"        this.columnHandle = columnHandle;\n    }\n\n    @Override\n    public final boolean isNull()\n    {\n        return value.isMissingNode() || value.isNull();\n    }\n\n    @Override\n    public final long getLong()\n    {\n        long millis = getMillis();\n\n        Type type = columnHandle.getType();\n\n        if (type == TIME || type == TIME_WITH_TIME_ZONE) {\n            if (millis < 0 || millis >= TimeUnit.DAYS.toMillis(1)) {\n                throw new PrestoException(\n                        DECODER_CONVERSION_NOT_SUPPORTED,\n                        format(\"could not parse value '%s' as '%s' for column '%s'\", value.asText(), columnHandle.getType(), columnHandle.getName()));\n            }\n        }\n\n        if (type.equals(DATE)) {\n            return TimeUnit.MILLISECONDS.toDays(millis);\n        }\n        if (type.equals(TIMESTAMP) || type.equals(TIME)) {\n            return millis;\n        }\n        if (type.equals(TIMESTAMP_WITH_TIME_ZONE) || type.equals(TIME_WITH_TIME_ZONE)) {\n            return packDateTimeWithZone(millis, 0);\n        }\n\n        return millis;\n    }\n","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-record-decoder/src/main/java/com/facebook/presto/decoder/json/AbstractDateTimeJsonValueProvider.java#L42-L78","documentation":"AbstractDateTimeJsonValueProvider.getLong() converts a JSON datetime value to epoch millis via getMillis(), then range-checks it against the column type. For TIME/TIME_WITH_TIME_ZONE columns the millis value must be within one day [0, 86399999); if the parsed value falls outside, DECODER_CONVERSION_NOT_SUPPORTED is thrown. The value parsed as a duration/time-of-day is invalid for the target TIME column.","triggerScenarios":"JSON value parses to a full timestamp (with date component) or an epoch far beyond one day, but the column is declared TIME or TIME_WITH_TIME_ZONE; negative millis from dates before epoch parsed as time-of-day.","commonSituations":"Declaring a column TIME while the JSON feed contains '2024-01-01T10:30:00' timestamps; timezone offsets pushing parsed millis negative; schema evolution changed the source field from time-only to full timestamp.","solutions":["Change the column type to TIMESTAMP/TIMESTAMP_WITH_TIME_ZONE if the source carries full timestamps","Extract only the time-of-day component (e.g. via format hint or JSON path) so millis stays within [0, 86400000)","Validate/normalize the JSON values upstream to match the declared column type","Check the format hint pattern so parsing yields the intended time-of-day millis"],"exampleFix":"// before\n{\"name\": \"event_time\", \"type\": \"time\", \"mapping\": \"$.ts\"}  // $.ts = '2024-05-01T10:30:00Z'\n// after\n{\"name\": \"event_time\", \"type\": \"timestamp\", \"mapping\": \"$.ts\"}","handlingStrategy":"validation","validationCode":"boolean fitsTimeColumn(long millis) {\n    return millis >= 0 && millis < TimeUnit.DAYS.toMillis(1);\n}\n// check fitsTimeColumn(parsedMillis) when the column is declared TIME/TIME_WITH_TIME_ZONE","typeGuard":null,"tryCatchPattern":"try { row.getLong(columnName); }\ncatch (PrestoException e) {\n    if (e.getErrorCode().getName().equals(\"DECODER_CONVERSION_NOT_SUPPORTED\")) {\n        log.warn(\"Time-of-day out of range for TIME column {}\", columnName); return null;\n    }\n    throw e;\n}","preventionTips":["Declare TIMESTAMP (not TIME) columns when the source carries full timestamps","Extract time-of-day only, or use a format hint that parses just the clock time","Add range checks on parsed millis in ingestion tests"],"tags":["json","decoding","datetime","type-conversion"],"backgroundTag":"datetime-out-of-range","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"}