{"record":{"id":"6692fd2e3406cc52","repo":"apache/iceberg","slug":"avro-does-not-support-timestamp-type-with-precisio-6692fd","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":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/formats/avro/typeutils/AvroSchemaConverter.java","lineNumber":522,"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":504,"sourceCodeEnd":540,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/formats/avro/typeutils/AvroSchemaConverter.java#L504-L540","documentation":"Thrown when converting a Flink TIMESTAMP_WITH_LOCAL_TIME_ZONE type to Avro with legacyTimestampMapping=false and precision greater than 6. Avro offers timestampMillis and timestampMicros only, so precisions 7-9 cannot be represented in an Avro schema.","triggerScenarios":"Calling AvroSchemaConverter.convertToSchema with a LocalZonedTimestampType of precision 7-9 and legacyTimestampMapping=false.","commonSituations":"Flink tables with TIMESTAMP_LTZ(9) columns (common with high-precision event time) being written to Avro sinks.","solutions":["Cast the column to TIMESTAMP_LTZ(6) or TIMESTAMP_LTZ(3) before writing.","Change the DDL to define the column with precision 3 or 6.","Use a storage format that supports nanoseconds (e.g. Parquet) if precision 7-9 is required.","Truncate at ingestion so downstream Avro writers never see the high precision."],"exampleFix":"// before\n// `event_ts` TIMESTAMP_LTZ(9)\n// after\n// `event_ts` TIMESTAMP_LTZ(6)","handlingStrategy":"validation","validationCode":"if (logicalType instanceof LocalZonedTimestampType && ((LocalZonedTimestampType) logicalType).getPrecision() > 6) { /* cast to TIMESTAMP_LTZ(3|6) before writing */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use TIMESTAMP_LTZ(3) or TIMESTAMP_LTZ(6) for Avro sinks.","Standardize event-time precision pipeline-wide.","Verify connector default precisions when defining DDL.","Prefer Parquet for nanosecond-precision event time."],"tags":["flink","avro","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"}