{"record":{"id":"6be48a4807d67e0d","repo":"apache/iceberg","slug":"avro-does-not-support-local-timestamp-type-with-pr-6be48a","errorCode":null,"errorMessage":"Avro does not support LOCAL TIMESTAMP type with precision: ${precision}, it only supports precision less than 6.","messagePattern":"Avro does not support LOCAL TIMESTAMP type with precision: (.+?), it only supports precision less than 6\\.","errorType":"exception","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/formats/avro/typeutils/AvroSchemaConverter.java","lineNumber":500,"sourceCode":"        precision = timestampType.getPrecision();\n        org.apache.avro.LogicalType avroLogicalType;\n        if (legacyTimestampMapping) {\n          if (precision <= 3) {\n            avroLogicalType = LogicalTypes.timestampMillis();\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 3.\");\n          }\n        } else {\n          if (precision <= 3) {\n            avroLogicalType = LogicalTypes.localTimestampMillis();\n          } else if (precision <= 6) {\n            avroLogicalType = LogicalTypes.localTimestampMicros();\n          } else {\n            throw new IllegalArgumentException(\n                \"Avro does not support LOCAL TIMESTAMP type \"\n                    + \"with precision: \"\n                    + precision\n                    + \", 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();","sourceCodeStart":482,"sourceCodeEnd":518,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/formats/avro/typeutils/AvroSchemaConverter.java#L482-L518","documentation":"When converting a Flink TIMESTAMP(p) to Avro without legacy mapping, precision up to 6 maps to localTimestampMicros; anything above 6 has no Avro local-timestamp logical type, so the converter rejects it rather than truncate silently.","triggerScenarios":"Calling AvroSchemaConverter.convertToSchema on a type containing TIMESTAMP(7) through TIMESTAMP(9) with legacyTimestampMapping=false.","commonSituations":"Flink DDL using the maximum TIMESTAMP(9) precision being written through an Avro serialization path; schema evolution where a column's precision was increased beyond micros.","solutions":["Declare the column as TIMESTAMP(6) or lower so it maps to localTimestampMicros","Cast the timestamp to TIMESTAMP(6) before conversion","If nanosecond precision is required, serialize via a different format (e.g. Arrow/Parquet) instead of Avro"],"exampleFix":"// before\ncolumns: TIMESTAMP(9)\nSchema avro = AvroSchemaConverter.convertToSchema(rowType, \"record\", false);\n// after\ncolumns: TIMESTAMP(6)\nSchema avro = AvroSchemaConverter.convertToSchema(rowType, \"record\", false);","handlingStrategy":"validation","validationCode":"if (timestampType.getPrecision() > 6) {\n  throw new IllegalArgumentException(\"Avro local timestamp supports precision <= 6; got \" + timestampType.getPrecision());\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Cap TIMESTAMP precision at 6 for Avro pipelines","Avoid TIMESTAMP(9); Flink's max precision exceeds Avro's logical-type limits","Document format precision limits in your schema conventions"],"tags":["avro","flink","timestamp-precision"],"backgroundTag":"value-out-of-range","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}