apache/iceberg · error · IllegalArgumentException
Invalid base type for decimal
Error message
Invalid base type for decimal: %s
What it means
Validation in ParquetAvro's decimal schema modifier: the Avro base type carrying the decimal logical type must be int (precision<=9), long (precision<=18), fixed, or binary — the default branch rejects any other base. The %s is the schema type; it fires while preparing an Avro-to-Parquet decimal conversion with an incompatible base type.
Solutions
- Store the decimal over binary/fixed or an int/long sized for the precision
- Regenerate the Avro schema with a valid decimal base type
- Validate precision vs base type before conversion
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at parquet/src/main/java/org/apache/iceberg/parquet/ParquetAvro.java:98 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/4666431432aa62de.
Report an issue: GitHub.
Appendix: source
Thrown at parquet/src/main/java/org/apache/iceberg/parquet/ParquetAvro.java:98
return schema;
}
@Override
public void validate(Schema schema) {
super.validate(schema);
switch (schema.getType()) {
case INT:
Preconditions.checkArgument(
precision <= 9, "Int cannot hold decimal precision: %s", precision);
break;
case LONG:
Preconditions.checkArgument(
precision <= 18, "Long cannot hold decimal precision: %s", precision);
break;
case FIXED:
break;
default:
throw new IllegalArgumentException("Invalid base type for decimal: " + schema);
}
Preconditions.checkArgument(scale >= 0, "Scale %s cannot be negative", scale);
Preconditions.checkArgument(
scale <= precision, "Scale %s cannot be less than precision %s", scale, precision);
}
}
static {
LogicalTypes.register(
ParquetDecimal.NAME,
schema -> {
int precision = Integer.parseInt(schema.getProp("precision"));
int scale = Integer.parseInt(schema.getProp("scale"));
return new ParquetDecimal(precision, scale);
});
}
private static class IntDecimalConversion extends Conversion<BigDecimal> {View on GitHub (pinned to 86d9c8fc54)