{"record":{"id":"c5c82f50c3620718","repo":"prestodb/presto","slug":"not-supported-c5c82f","errorCode":"NOT_SUPPORTED","errorMessage":"NOT_SUPPORTED: e.getMessage()","messagePattern":"NOT_SUPPORTED: e\\.getMessage\\(\\)","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/operator/scalar/DateTimeFunctions.java","lineNumber":130,"sourceCode":"    @ScalarFunction\n    @SqlType(StandardTypes.TIME_WITH_TIME_ZONE)\n    public static long currentTime(SqlFunctionProperties properties)\n    {\n        // We do all calculation in UTC, as session.getStartTime() is in UTC\n        // and we need to have UTC millis for packDateTimeWithZone\n        long millis = UTC_CHRONOLOGY.millisOfDay().get(properties.getSessionStartTime());\n\n        // However, those UTC millis are pointing to the correct UTC timestamp\n        // Our TIME WITH TIME ZONE representation does use UTC 1970-01-01 representation\n        // So we have to hack here in order to get valid representation\n        // of TIME WITH TIME ZONE\n        millis -= valueToSessionTimeZoneOffsetDiff(properties.getSessionStartTime(), getDateTimeZone(properties.getTimeZoneKey()));\n\n        try {\n            return packDateTimeWithZone(millis, properties.getTimeZoneKey());\n        }\n        catch (NotSupportedException | TimeZoneNotSupportedException e) {\n            throw new PrestoException(NOT_SUPPORTED, e.getMessage(), e);\n        }\n        catch (IllegalArgumentException e) {\n            throw new PrestoException(INVALID_FUNCTION_ARGUMENT, e.getMessage(), e);\n        }\n        catch (ArithmeticException e) {\n            throw new PrestoException(NUMERIC_VALUE_OUT_OF_RANGE, e.getMessage(), e);\n        }\n    }\n\n    @Description(\"current time without time zone\")\n    @ScalarFunction(\"localtime\")\n    @SqlType(StandardTypes.TIME)\n    public static long localTime(SqlFunctionProperties properties)\n    {\n        if (properties.isLegacyTimestamp()) {\n            long millis = UTC_CHRONOLOGY.millisOfDay().get(properties.getSessionStartTime());\n            return millis - valueToSessionTimeZoneOffsetDiff(properties.getSessionStartTime(), getDateTimeZone(properties.getTimeZoneKey()));\n        }","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/operator/scalar/DateTimeFunctions.java#L112-L148","documentation":"current_time / current_timestamp resolution can fail when the session time zone key is not supported by the underlying date/time library (NotSupportedException or TimeZoneNotSupportedException). Presto wraps these as NOT_SUPPORTED, propagating the underlying message.","triggerScenarios":"Session time zone set to a zone ID the Joda/ICU backend cannot resolve (custom or removed zone IDs); using current_time with such a session start time.","commonSituations":"Clients setting SET SESSION time_zone to a non-IANA id or an alias dropped in newer tzdata; shared queries moved between clusters with different tzdata versions.","solutions":["Set the session time zone to a valid IANA zone ID (e.g. America/Los_Angeles)","Update the Presto/time-tzdata version so the zone is supported, or pick an equivalent supported zone","Catch NOT_SUPPORTED and fall back to UTC in the client"],"exampleFix":"// before\nSET SESSION time_zone = 'PST8PDT';\nSELECT current_time;\n// after\nSET SESSION time_zone = 'America/Los_Angeles';\nSELECT current_time;\n","handlingStrategy":"try-catch","validationCode":"ZoneId.of(tz); // throws if unknown","typeGuard":null,"tryCatchPattern":"catch (PrestoException e) { if (e.getErrorCode().getName().equals(\"NOT_SUPPORTED\")) fallbackToUtc(); else throw e; }","preventionTips":["Use valid IANA zone IDs"],"tags":["sql","scalar-function","timezone","unsupported"],"backgroundTag":"unsupported-timezone","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"}