{"record":{"id":"655b162b045c3ed0","repo":"apache/flink","slug":"avro-does-not-support-time-type-with-precision-s","errorCode":null,"errorMessage":"Avro does not support TIME type with precision: %s, it only supports precision less than 3.","messagePattern":"Avro does not support TIME type with precision: (.+?), it only supports precision less than 3\\.","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":521,"sourceCode":"                        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\n                                    + \", it only supports precision less than 3.\");\n                }\n                // use int to represents Time, we only support millisecond when deserialization\n                Schema time =\n                        LogicalTypes.timeMillis().addToSchema(SchemaBuilder.builder().intType());\n                return nullable ? nullableSchema(time) : time;\n            case DECIMAL:\n                DecimalType decimalType = (DecimalType) logicalType;\n                // store BigDecimal as byte[]\n                Schema decimal =\n                        LogicalTypes.decimal(decimalType.getPrecision(), decimalType.getScale())\n                                .addToSchema(SchemaBuilder.builder().bytesType());\n                return nullable ? nullableSchema(decimal) : decimal;\n            case ROW:\n                RowType rowType = (RowType) logicalType;\n                List<String> fieldNames = rowType.getFieldNames();","sourceCodeStart":503,"sourceCodeEnd":539,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/typeutils/AvroSchemaConverter.java#L503-L539","documentation":"Thrown when converting TIME(p) WITHOUT TIME ZONE to an Avro schema with precision above 3. The Avro format serializes TIME as the 'time-millis' logical type on an int, which only supports milliseconds, so TIME(4)-TIME(9) is rejected.","triggerScenarios":"convertToSchema on a TimeType with precision > 3; an avro/avro-confluent-registry table with a TIME(6) column.","commonSituations":"TIME columns defined without precision after Flink started supporting TIME(p) up to 9; schemas reused from engines that allow microsecond times.","solutions":["Declare the column as TIME(3) or plain TIME(0).","If microsecond time-of-day is required, model it as BIGINT or INTERVAL and convert."],"exampleFix":"-- before\ntime_col TIME(6),\n\n-- after\ntime_col TIME(3),","handlingStrategy":"validation","validationCode":"import org.apache.flink.table.types.logical.TimeType;\n\nboolean avroConvertible(TimeType t) { return t.getPrecision() <= 3; }","typeGuard":"boolean fitsAvro(TimeType t) { return t.getPrecision() <= 3; }","tryCatchPattern":null,"preventionTips":["Use TIME(0)/TIME(3) columns for Avro-backed tables.","Keep sub-millisecond time-of-day values as BIGINT micros if needed."],"tags":["avro","time","precision","flink","schema-conversion"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}