{"record":{"id":"3c072fbd4d6cad0b","repo":"apache/flink","slug":"avro-does-not-support-timestamp-type-with-precisio-3c072f","errorCode":null,"errorMessage":"Avro does not support TIMESTAMP type with precision: %s, it only supports precision less than 6.","messagePattern":"Avro does not support TIMESTAMP type with precision: (.+?), it only supports precision less than 6\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/typeutils/AvroSchemaConverter.java","lineNumber":505,"sourceCode":"                                        + \", it only supports precision less than 6.\");\n                    }\n                }\n                Schema timestamp = avroLogicalType.addToSchema(SchemaBuilder.builder().longType());\n                return nullable ? nullableSchema(timestamp) : timestamp;\n            case TIMESTAMP_WITH_LOCAL_TIME_ZONE:\n                if (legacyTimestampMapping) {\n                    throw new UnsupportedOperationException(\n                            \"Unsupported to derive Schema for type: \" + logicalType);\n                } else {\n                    final LocalZonedTimestampType localZonedTimestampType =\n                            (LocalZonedTimestampType) logicalType;\n                    precision = localZonedTimestampType.getPrecision();\n                    if (precision <= 3) {\n                        avroLogicalType = LogicalTypes.timestampMillis();\n                    } else if (precision <= 6) {\n                        avroLogicalType = LogicalTypes.timestampMicros();\n                    } else {\n                        throw new IllegalArgumentException(\n                                \"Avro does not support TIMESTAMP type \"\n                                        + \"with precision: \"\n                                        + precision\n                                        + \", it only supports precision less than 6.\");\n                    }\n                    timestamp = avroLogicalType.addToSchema(SchemaBuilder.builder().longType());\n                    return nullable ? nullableSchema(timestamp) : timestamp;\n                }\n            case DATE:\n                // use int to represents Date\n                Schema date = LogicalTypes.date().addToSchema(SchemaBuilder.builder().intType());\n                return nullable ? nullableSchema(date) : date;\n            case TIME_WITHOUT_TIME_ZONE:\n                precision = ((TimeType) logicalType).getPrecision();\n                if (precision > 3) {\n                    throw new IllegalArgumentException(\n                            \"Avro does not support TIME type with precision: \"\n                                    + precision","sourceCodeStart":487,"sourceCodeEnd":523,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/typeutils/AvroSchemaConverter.java#L487-L523","documentation":"Thrown when converting TIMESTAMP(p) WITH LOCAL TIME ZONE to an Avro schema with modern mapping and precision above 6. Avro only defines timestamp-millis (p<=3) and timestamp-micros (p<=6) logical types for zoned timestamps, so precisions 7-9 cannot be represented.","triggerScenarios":"convertToSchema on TIMESTAMP_LTZ with precision 7-9; an avro-format table declaring TIMESTAMP(9) WITH LOCAL TIME ZONE (or TIMESTAMP_LTZ(9)).","commonSituations":"TIMESTAMP_LTZ columns defined without explicit precision (defaults to 9); high-frequency event pipelines requiring nanosecond zoned timestamps.","solutions":["Declare the column as TIMESTAMP(3) WITH LOCAL TIME ZONE or TIMESTAMP(6) WITH LOCAL TIME ZONE.","Preserve nanoseconds by storing them in a separate BIGINT column."],"exampleFix":"-- before\nts TIMESTAMP_LTZ(9),\n\n-- after\nts TIMESTAMP(6) WITH LOCAL TIME ZONE,","handlingStrategy":"validation","validationCode":"import org.apache.flink.table.types.logical.LocalZonedTimestampType;\n\nboolean avroConvertible(LocalZonedTimestampType t) { return t.getPrecision() <= 6; }","typeGuard":"boolean fitsAvro(LocalZonedTimestampType t) { return t.getPrecision() <= 6; }","tryCatchPattern":null,"preventionTips":["Declare TIMESTAMP(3)/TIMESTAMP(6) WITH LOCAL TIME ZONE explicitly; never rely on the precision-9 default for Avro sinks."],"tags":["avro","timestamp-ltz","precision","flink","schema-conversion"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}