{"record":{"id":"cc9c36f6d9ccc0dd","repo":"prestodb/presto","slug":"hive-timezone-mismatch","errorCode":"HIVE_TIMEZONE_MISMATCH","errorMessage":"To write Hive data, your JVM timezone must match the Hive storage timezone. Add -Duser.timezone=%s to your JVM arguments.","messagePattern":"To write Hive data, your JVM timezone must match the Hive storage timezone\\. Add -Duser\\.timezone=(.+?) to your JVM arguments\\.","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-hive/src/main/java/com/facebook/presto/hive/HiveMetadata.java","lineNumber":3549,"sourceCode":"        ImmutableList.Builder<PartitionUpdate> result = ImmutableList.builder();\n        for (Slice fragment : fragments) {\n            byte[] bytes = fragment.getBytes();\n            PartitionUpdate partitionUpdate;\n            if (optimizedPartitionUpdateSerializationEnabled) {\n                partitionUpdate = deserializeZstdCompressed(partitionUpdateSmileCodec, bytes);\n            }\n            else {\n                partitionUpdate = partitionUpdateCodec.fromJson(bytes);\n            }\n            result.add(partitionUpdate);\n        }\n        return result.build();\n    }\n\n    private void verifyJvmTimeZone(ConnectorSession session)\n    {\n        if (session.getSqlFunctionProperties().isLegacyTimestamp() && !allowCorruptWritesForTesting && !timeZone.equals(DateTimeZone.getDefault())) {\n            throw new PrestoException(HIVE_TIMEZONE_MISMATCH, format(\n                    \"To write Hive data, your JVM timezone must match the Hive storage timezone. Add -Duser.timezone=%s to your JVM arguments.\",\n                    timeZone.getID()));\n        }\n    }\n\n    private static HiveStorageFormat extractHiveStorageFormat(Table table)\n    {\n        StorageFormat storageFormat = table.getStorage().getStorageFormat();\n        String outputFormat = storageFormat.getOutputFormat();\n        String serde = storageFormat.getSerDe();\n\n        for (HiveStorageFormat format : values()) {\n            if (format.getOutputFormat().equals(outputFormat) && format.getSerDe().equals(serde)) {\n                return format;\n            }\n        }\n        throw new PrestoException(HIVE_UNSUPPORTED_FORMAT, format(\"Output format %s with SerDe %s is not supported\", outputFormat, serde));\n    }","sourceCodeStart":3531,"sourceCodeEnd":3567,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-hive/src/main/java/com/facebook/presto/hive/HiveMetadata.java#L3531-L3567","documentation":"Write-path consistency check for legacy timestamp mode: the coordinator's JVM default timezone differs from the Hive storage timezone, which would corrupt timestamp values written with legacy semantics.","triggerScenarios":"Thrown at presto-hive/src/main/java/com/facebook/presto/hive/HiveMetadata.java:3549 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Restart the JVM with -Duser.timezone=<hive-storage-timezone>","Set the storage timezone property to match the JVM default","Use non-legacy timestamp semantics if the data allows"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}