{"record":{"id":"9acda20a44970609","repo":"prestodb/presto","slug":"decoder-conversion-not-supported-9acda2","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/MillisecondsSinceEpochJsonFieldDecoder.java","lineNumber":80,"sourceCode":"            extends AbstractDateTimeJsonValueProvider\n    {\n        public MillisecondsSinceEpochJsonValueProvider(JsonNode value, DecoderColumnHandle columnHandle)\n        {\n            super(value, columnHandle);\n        }\n\n        @Override\n        protected long getMillis()\n        {\n            if (value.isIntegralNumber() && !value.isBigInteger()) {\n                return value.longValue();\n            }\n            if (value.isValueNode()) {\n                try {\n                    return parseLong(value.asText());\n                }\n                catch (NumberFormatException e) {\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            throw new PrestoException(\n                    DECODER_CONVERSION_NOT_SUPPORTED,\n                    format(\"could not parse non-value node as '%s' for column '%s'\", columnHandle.getType(), columnHandle.getName()));\n        }\n    }\n}\n","sourceCodeStart":62,"sourceCodeEnd":91,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-record-decoder/src/main/java/com/facebook/presto/decoder/json/MillisecondsSinceEpochJsonFieldDecoder.java#L62-L91","documentation":"MillisecondsSinceEpochJsonFieldDecoder.getMillis converts a JSON value into epoch milliseconds by calling Long.parseLong on the node's text. When the text is not a valid Java long (e.g. a fractional, empty, or non-numeric string), NumberFormatException is caught and rethrown as a PrestoException with DECODER_CONVERSION_NOT_SUPPORTED. The library throws this because a JSON string/number field cannot be losslessly interpreted as a millisecond timestamp for the requested column.","triggerScenarios":"Kafka/record decoder table column defined with dataFormat 'milliseconds-since-epoch' whose underlying JSON field's value node text fails Long.parseLong: e.g. '{\"ts\": \"2024-01-01T00:00:00Z\"}' or '{\"ts\": \"1704067200.123\"}' or '{\"ts\": \"\"}' mapped to a bigint timestamp column, when a query reads that column via getMillis.","commonSituations":"Producers changed the timestamp format (ISO-8601 string instead of epoch millis); timestamps serialized with sub-second precision as decimal; null/empty strings in the payload; users confusing 'milliseconds-since-epoch' with 'seconds-since-epoch' or RFC2822 decoders.","solutions":["Fix the producing application to emit integer epoch milliseconds for this field.","If the source emits seconds, switch the column's dataFormat to 'seconds-since-epoch' instead of 'milliseconds-since-epoch'.","If the source emits ISO-8601/RFC2822 strings, use the matching JSON field decoder (e.g. iso8601 / rfc2822 dataFormat).","Add a cleanup/coercion step upstream (stream processor) that converts the field to a valid long before Presto reads the topic.","Exclude or cast the offending column out of the table definition so the decoder is never invoked on it."],"exampleFix":"// table definition before (fails on ISO strings)\n-- ts VARCHAR MAP ... dataFormat = 'milliseconds-since-epoch'\n-- after: match decoder to the actual payload format\nCREATE TABLE kafka_message (\n  ...\n  event_time TIMESTAMP WITH TIME ZONE\n    WITH (data_format = 'iso8601', mapping = 'ts')\n);","handlingStrategy":"validation","validationCode":"// Before querying a 'milliseconds-since-epoch' column, validate the field:\nboolean isEpochMillis(String v) {\n  if (v == null || v.isEmpty()) return false;\n  try { Long.parseLong(v.trim()); return true; } catch (NumberFormatException e) { return false; }\n}","typeGuard":null,"tryCatchPattern":"// Query wrapper (JDBC)\ntry (ResultSet rs = stmt.executeQuery(sql)) { ... }\ncatch (SQLException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"could not parse value\")) {\n    log.error(\"Non-numeric timestamp in decoder column; fix payload or dataFormat\", e);\n  } else throw e;\n}","preventionTips":["Contract-test producer payloads against the table's decoder definitions on every schema change.","Prefer 'iso8601' decoder when timestamps are strings.","Never mix seconds/milliseconds formats between producer and decoder.","Sample topic messages (kafkacat/console consumer) after any producer deploy."],"tags":["presto","kafka-decoder","json","timestamp","number-format"],"backgroundTag":"timestamp-parse-failed","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"}