{"record":{"id":"a80fe4949c6089d2","repo":"apache/iceberg","slug":"invalid-precision","errorCode":null,"errorMessage":"Invalid precision: ","messagePattern":"Invalid precision: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink/v2.2/flink/src/main/java/org/apache/iceberg/flink/data/FlinkOrcReaders.java","lineNumber":69,"sourceCode":"\nclass FlinkOrcReaders {\n  private FlinkOrcReaders() {}\n\n  static OrcValueReader<StringData> strings() {\n    return StringReader.INSTANCE;\n  }\n\n  static OrcValueReader<Integer> dates() {\n    return DateReader.INSTANCE;\n  }\n\n  static OrcValueReader<DecimalData> decimals(int precision, int scale) {\n    if (precision <= 18) {\n      return new Decimal18Reader(precision, scale);\n    } else if (precision <= 38) {\n      return new Decimal38Reader(precision, scale);\n    } else {\n      throw new IllegalArgumentException(\"Invalid precision: \" + precision);\n    }\n  }\n\n  static OrcValueReader<Integer> times() {\n    return TimeReader.INSTANCE;\n  }\n\n  static OrcValueReader<TimestampData> timestamps() {\n    return TimestampReader.INSTANCE;\n  }\n\n  static OrcValueReader<TimestampData> timestampTzs() {\n    return TimestampTzReader.INSTANCE;\n  }\n\n  static <T> OrcValueReader<ArrayData> array(OrcValueReader<T> elementReader) {\n    return new ArrayReader<>(elementReader);\n  }","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v2.2/flink/src/main/java/org/apache/iceberg/flink/data/FlinkOrcReaders.java#L51-L87","documentation":"FlinkOrcReaders.decimals() builds ORC decimal readers and only supports precision up to 38: values <= 18 use Decimal18Reader (long-backed), values 19-38 use Decimal38Reader. Any precision above 38 cannot be represented by ORC decimal readers and throws IllegalArgumentException. This guards against reading ORC columns whose declared precision exceeds what Iceberg's Flink ORC integration handles.","triggerScenarios":"Calling FlinkOrcReaders.decimals(precision, scale) with precision > 38, typically from an ORC read schema built from an Iceberg DecimalType with precision > 38.","commonSituations":"A table column was created with an out-of-spec precision (Iceberg itself caps decimal precision at 38), or custom code constructs readers manually with an invalid precision, or a type mapping from another engine (e.g. Flink DECIMAL(42,5)) is passed through.","solutions":["Fix the Iceberg/Flink schema so the column precision is <= 38 (and preferably <= 18 for the faster long-backed reader)","Re-create/rewrite the table column with a valid precision, e.g. DECIMAL(38,scale) as the maximum","If the source ORC file truly has precision > 38, re-write the data before reading it through this reader"],"exampleFix":"// before\nOrcValueReader<DecimalData> r = FlinkOrcReaders.decimals(42, 5); // throws\n// after\nOrcValueReader<DecimalData> r = FlinkOrcReaders.decimals(38, 5);","handlingStrategy":"validation","validationCode":"if (precision > 38 || precision <= 0) {\n  throw new IllegalArgumentException(\"Decimal precision must be in (0, 38], got: \" + precision);\n}\nOrcValueReader<DecimalData> reader = FlinkOrcReaders.decimals(precision, scale);","typeGuard":null,"tryCatchPattern":"try {\n  reader = FlinkOrcReaders.decimals(precision, scale);\n} catch (IllegalArgumentException e) {\n  logger.error(\"Unsupported decimal precision: {}\", precision, e);\n  throw new SchemaException(\"Column precision not supported for ORC read\", e);\n}","preventionTips":["Cap decimal precision at 38 (Iceberg spec max) at schema-design time","Prefer precision <= 18 for the faster long-backed reader","Validate precision before building readers in generic schema-mapping code"],"tags":["flink","orc","decimal"],"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-14T11:17:12.474Z"}