{"record":{"id":"3451c37d5552eea6","repo":"apache/iceberg","slug":"invalid-precision-3451c3","errorCode":null,"errorMessage":"Invalid precision: ","messagePattern":"Invalid precision: ","errorType":"exception","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/data/FlinkOrcWriters.java","lineNumber":87,"sourceCode":"  static OrcValueWriter<TimestampData> timestampTzs() {\n    return TimestampTzWriter.INSTANCE;\n  }\n\n  static OrcValueWriter<TimestampData> timestampNanos() {\n    return TimestampNanoWriter.INSTANCE;\n  }\n\n  static OrcValueWriter<TimestampData> timestampNanoTzs() {\n    return TimestampNanoTzWriter.INSTANCE;\n  }\n\n  static OrcValueWriter<DecimalData> decimals(int precision, int scale) {\n    if (precision <= 18) {\n      return new Decimal18Writer(precision, scale);\n    } else if (precision <= 38) {\n      return new Decimal38Writer(precision, scale);\n    } else {\n      throw new IllegalArgumentException(\"Invalid precision: \" + precision);\n    }\n  }\n\n  static <T> OrcValueWriter<ArrayData> list(\n      OrcValueWriter<T> elementWriter, LogicalType elementType) {\n    return new ListWriter<>(elementWriter, elementType);\n  }\n\n  static <K, V> OrcValueWriter<MapData> map(\n      OrcValueWriter<K> keyWriter,\n      OrcValueWriter<V> valueWriter,\n      LogicalType keyType,\n      LogicalType valueType) {\n    return new MapWriter<>(keyWriter, valueWriter, keyType, valueType);\n  }\n\n  static OrcValueWriter<RowData> struct(List<OrcValueWriter<?>> writers, List<LogicalType> types) {\n    int[] fieldIndexes = new int[writers.size()];","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/data/FlinkOrcWriters.java#L69-L105","documentation":"FlinkOrcWriters.decimals() selects an ORC decimal writer based on precision: Decimal18Writer for precision <= 18 (fits in a long) and Decimal38Writer for precision <= 38. Any precision above 38 cannot be represented by Iceberg's decimal model or ORC's decimal logical type, so the factory throws IllegalArgumentException immediately.","triggerScenarios":"Calling FlinkOrcWriters.decimals(precision, scale) with precision > 38 (or negative), typically while building an ORC appender from a Flink RowType/ Iceberg Types.DecimalType whose precision exceeds 38.","commonSituations":"A table schema was created with an out-of-spec decimal precision (e.g. DECIMAL(50, 10)); a schema evolution or external catalog registered an oversized precision; a buggy type-derivation path computed precision instead of failing earlier at schema validation.","solutions":["Fix the source schema so the decimal precision is within 1..38 (Iceberg/ORC max).","Re-create/evolve the table column with a valid precision, e.g. DECIMAL(38, scale), and migrate data.","If precision comes from config or another catalog, validate/clamp it before constructing the writer and fail with a clear schema-validation error upstream."],"exampleFix":"// before\nTypes.DecimalType.of(50, 10) // invalid\n// after\nTypes.DecimalType.of(38, 10)","handlingStrategy":"validation","validationCode":"// java\nif (decimalType.precision() > 38 || decimalType.precision() < 1) {\n  throw new IllegalArgumentException(\n      \"Decimal precision \" + decimalType.precision() + \" out of range [1,38]\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate decimal precision <= 38 at schema-definition time, before any writer construction.","Centralize decimal type creation so precision bounds are enforced in one place.","Add schema tests covering max precision (38) and the failure case (39+)."],"tags":["flink","orc","decimal","schema"],"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-14T16:17:12.679Z"}