apache/flink · error · IllegalArgumentException
Avro does not support TIME type with precision: %s, it only
Error message
Avro does not support TIME type with precision: %s, it only supports precision less than 3.
What it means
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.
Source
Thrown at flink-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/typeutils/AvroSchemaConverter.java:521
avroLogicalType = LogicalTypes.timestampMicros();
} else {
throw new IllegalArgumentException(
"Avro does not support TIMESTAMP type "
+ "with precision: "
+ precision
+ ", it only supports precision less than 6.");
}
timestamp = avroLogicalType.addToSchema(SchemaBuilder.builder().longType());
return nullable ? nullableSchema(timestamp) : timestamp;
}
case DATE:
// use int to represents Date
Schema date = LogicalTypes.date().addToSchema(SchemaBuilder.builder().intType());
return nullable ? nullableSchema(date) : date;
case TIME_WITHOUT_TIME_ZONE:
precision = ((TimeType) logicalType).getPrecision();
if (precision > 3) {
throw new IllegalArgumentException(
"Avro does not support TIME type with precision: "
+ precision
+ ", it only supports precision less than 3.");
}
// use int to represents Time, we only support millisecond when deserialization
Schema time =
LogicalTypes.timeMillis().addToSchema(SchemaBuilder.builder().intType());
return nullable ? nullableSchema(time) : time;
case DECIMAL:
DecimalType decimalType = (DecimalType) logicalType;
// store BigDecimal as byte[]
Schema decimal =
LogicalTypes.decimal(decimalType.getPrecision(), decimalType.getScale())
.addToSchema(SchemaBuilder.builder().bytesType());
return nullable ? nullableSchema(decimal) : decimal;
case ROW:
RowType rowType = (RowType) logicalType;
List<String> fieldNames = rowType.getFieldNames();View on GitHub (pinned to 2f3c205e92)
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.
Example fix
-- before time_col TIME(6), -- after time_col TIME(3),
Defensive patterns
Strategy: validation
Validate before calling
import org.apache.flink.table.types.logical.TimeType;
boolean avroConvertible(TimeType t) { return t.getPrecision() <= 3; } Type guard
boolean fitsAvro(TimeType t) { return t.getPrecision() <= 3; } Prevention
- Use TIME(0)/TIME(3) columns for Avro-backed tables.
- Keep sub-millisecond time-of-day values as BIGINT micros if needed.
When it happens
Trigger: convertToSchema on a TimeType with precision > 3; an avro/avro-confluent-registry table with a TIME(6) column.
Common situations: TIME columns defined without precision after Flink started supporting TIME(p) up to 9; schemas reused from engines that allow microsecond times.
Related errors
- Avro does not support TIMESTAMP type with precision: %s, it
- Avro does not support LOCAL TIMESTAMP type with precision: %
- Avro does not support TIMESTAMP type with precision: %s, it
- Unexpected object type for TIME logical type. Received: {}
- Unsupported to derive Schema for type: %s
AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14).
Data as JSON: /api/errors/655b162b045c3ed0.
Report an issue: GitHub.