{"record":{"id":"5b115ae7cfed0cde","repo":"prestodb/presto","slug":"not-supported-5b115a","errorCode":"NOT_SUPPORTED","errorMessage":"Unsupported representation for field '%s' of type TIMESTAMP: %s [%s]","messagePattern":"Unsupported representation for field '(.+?)' of type TIMESTAMP: (.+?) \\[(.+?)\\]","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-elasticsearch/src/main/java/com/facebook/presto/elasticsearch/decoders/TimestampDecoder.java","lineNumber":81,"sourceCode":"            }\n            String valueString = documentField.toJson().asJsonArray().get(0).toString();\n            value = valueString.replace(\"\\\"\", \"\");\n        }\n\n        if (value == null) {\n            output.appendNull();\n            return;\n        }\n\n        LocalDateTime timestamp;\n        if (value instanceof String) {\n            timestamp = ISO_DATE_TIME.parse((String) value, LocalDateTime::from);\n        }\n        else if (value instanceof Number) {\n            timestamp = LocalDateTime.ofInstant(Instant.ofEpochMilli(((Number) value).longValue()), ZULU);\n        }\n        else {\n            throw new PrestoException(NOT_SUPPORTED, format(\n                    \"Unsupported representation for field '%s' of type TIMESTAMP: %s [%s]\",\n                    path,\n                    value.getClass().getSimpleName(),\n                    value));\n        }\n\n        long epochMillis = timestamp.atZone(zoneId)\n                .toInstant()\n                .toEpochMilli();\n\n        TIMESTAMP.writeLong(output, epochMillis);\n    }\n}\n","sourceCodeStart":63,"sourceCodeEnd":95,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-elasticsearch/src/main/java/com/facebook/presto/elasticsearch/decoders/TimestampDecoder.java#L63-L95","documentation":"TimestampDecoder supports timestamps represented as ISO-8601 strings (parsed with ISO_DATE_TIME) or epoch-millisecond numbers. Any other representation (boolean, object, array, or a non-ISO string shape) is rejected with NOT_SUPPORTED because the decoder cannot deterministically convert it to LocalDateTime.","triggerScenarios":"decode() sees a value that is neither String nor Number for a TIMESTAMP-mapped field, e.g. {\"ts\": true}, {\"ts\": {\"$date\": ...}}, or an epoch-seconds float/decimal string like \"1700000000.123\".","commonSituations":"Documents written by MongoDB-style drivers use extended JSON {\"$date\": ...} objects; epoch values in seconds (not milliseconds) stored as strings; arrays from multi-valued mapping after the size check passed at exactly 1.","solutions":["Normalize the field in the documents to an ISO-8601 string (\"2024-01-01T00:00:00\") or epoch millis number, then reindex.","Use an ingest pipeline script to convert formats (e.g. multiply epoch seconds by 1000 and output as long).","Map the Presto column as VARCHAR/JSON and parse with date_parse/from_unixtime in SQL."],"exampleFix":"// before\n{\"ts\": {\"$date\": \"2024-01-01T00:00:00Z\"}}\n// after\n{\"ts\": \"2024-01-01T00:00:00\"}","handlingStrategy":"validation","validationCode":"function isSupportedTimestamp(v) {\n  if (typeof v === 'number') return true; // epoch millis\n  if (typeof v !== 'string') return false;\n  return /^\\d{4}-\\d{2}-\\d{2}(T[0-2]\\d:[0-5]\\d(:[0-5]\\d(\\.\\d+)?)?(Z|[+-]\\d{2}:\\d{2})?)?$/.test(v);\n}","typeGuard":"function isIsoStringOrEpochMillis(v) { return typeof v === 'number' || (typeof v === 'string' && !Number.isNaN(Date.parse(v))); }","tryCatchPattern":"try { SELECT ts FROM \"idx\" } catch (PrestoException e) { if (e.getErrorCode().getName().equals(\"NOT_SUPPORTED\")) { /* map as VARCHAR and parse with date_parse/from_unixtime */ } throw e; }","preventionTips":["Store timestamps as ISO-8601 strings or epoch milliseconds only.","Convert extended JSON like {\"$date\": ...} to plain strings at ingest.","Remember the decoder expects epoch MILLIS; convert seconds by multiplying by 1000.","Map the Elasticsearch field as date so indexing validates the format."],"tags":["elasticsearch","presto","not-supported","timestamp","format"],"backgroundTag":"unsupported-timestamp-format","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"}