{"record":{"id":"4666431432aa62de","repo":"apache/iceberg","slug":"invalid-base-type-for-decimal-s","errorCode":null,"errorMessage":"Invalid base type for decimal: %s","messagePattern":"Invalid base type for decimal: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"parquet/src/main/java/org/apache/iceberg/parquet/ParquetAvro.java","lineNumber":98,"sourceCode":"      return schema;\n    }\n\n    @Override\n    public void validate(Schema schema) {\n      super.validate(schema);\n      switch (schema.getType()) {\n        case INT:\n          Preconditions.checkArgument(\n              precision <= 9, \"Int cannot hold decimal precision: %s\", precision);\n          break;\n        case LONG:\n          Preconditions.checkArgument(\n              precision <= 18, \"Long cannot hold decimal precision: %s\", precision);\n          break;\n        case FIXED:\n          break;\n        default:\n          throw new IllegalArgumentException(\"Invalid base type for decimal: \" + schema);\n      }\n      Preconditions.checkArgument(scale >= 0, \"Scale %s cannot be negative\", scale);\n      Preconditions.checkArgument(\n          scale <= precision, \"Scale %s cannot be less than precision %s\", scale, precision);\n    }\n  }\n\n  static {\n    LogicalTypes.register(\n        ParquetDecimal.NAME,\n        schema -> {\n          int precision = Integer.parseInt(schema.getProp(\"precision\"));\n          int scale = Integer.parseInt(schema.getProp(\"scale\"));\n          return new ParquetDecimal(precision, scale);\n        });\n  }\n\n  private static class IntDecimalConversion extends Conversion<BigDecimal> {","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/parquet/src/main/java/org/apache/iceberg/parquet/ParquetAvro.java#L80-L116","documentation":"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.","triggerScenarios":"Thrown at parquet/src/main/java/org/apache/iceberg/parquet/ParquetAvro.java:98 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}