{"record":{"id":"2ae594038390c850","repo":"apache/iceberg","slug":"invalid-iceberg-type-s-corresponding-to-flink-log-2ae594","errorCode":null,"errorMessage":"Invalid iceberg type %s corresponding to Flink logical type %s","messagePattern":"Invalid iceberg type (.+?) corresponding to Flink logical type (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink/v2.2/flink/src/main/java/org/apache/iceberg/flink/data/FlinkOrcWriter.java","lineNumber":165,"sourceCode":"          }\n        case TIMESTAMP_NANO:\n          Types.TimestampNanoType timestampNanoType = (Types.TimestampNanoType) iPrimitive;\n          if (timestampNanoType.shouldAdjustToUTC()) {\n            return FlinkOrcWriters.timestampNanoTzs();\n          } else {\n            return FlinkOrcWriters.timestampNanos();\n          }\n        case STRING:\n          return FlinkOrcWriters.strings();\n        case UUID:\n        case FIXED:\n        case BINARY:\n          return GenericOrcWriters.byteArrays();\n        case DECIMAL:\n          Types.DecimalType decimalType = (Types.DecimalType) iPrimitive;\n          return FlinkOrcWriters.decimals(decimalType.precision(), decimalType.scale());\n        default:\n          throw new IllegalArgumentException(\n              String.format(\n                  \"Invalid iceberg type %s corresponding to Flink logical type %s\",\n                  iPrimitive, flinkPrimitive));\n      }\n    }\n  }\n}\n","sourceCodeStart":147,"sourceCodeEnd":173,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v2.2/flink/src/main/java/org/apache/iceberg/flink/data/FlinkOrcWriter.java#L147-L173","documentation":"FlinkOrcWriter's PrimitiveWriterBuilder reached the default branch of its switch: the Iceberg primitive type has no mapping to an ORC writer for the given Flink logical type. The library throws IllegalArgumentException naming both the Iceberg primitive and the Flink logical type so the mismatch is visible. It signals an Iceberg type that the Flink ORC writer does not support.","triggerScenarios":"Writing an Iceberg table via Flink where the row type's primitive is not one of the handled cases (e.g. an unexpected/iPrimitive combination reaching FlinkOrcWriter.Builder.primitive), such as writing a Flink type that maps to an Iceberg primitive with no ORC writer.","commonSituations":"Schema mismatch between the Flink RowType and the Iceberg schema (e.g. after an ALTER TABLE or a Flink connector upgrade), or custom TypeInformation producing an exotic Flink logical type, or a new Iceberg type added before the Flink ORC writer gained support.","solutions":["Align the Flink RowType with the Iceberg table schema so every primitive has a supported mapping","Check the Iceberg version's supported Flink-to-ORC type mappings and upgrade Iceberg if the type was added later","Cast or transform unsupported columns to supported types (e.g. STRING, DECIMAL(<=38)) before writing"],"exampleFix":"// before (Flink schema has unsupported type mapping)\n DataTypes.DECIMAL(42, 5) // -> Iceberg DecimalType(42,5), no writer\n// after\n DataTypes.DECIMAL(38, 5) // -> supported ORC decimal writer","handlingStrategy":"validation","validationCode":"// Ensure the Flink RowType matches the Iceberg schema before writing\nList<Types.NestedField> columns = table.schema().columns();\nfor (Types.NestedField f : columns) {\n  Preconditions.checkArgument(supportedMapping(f.type(), flinkRowType),\n      \"No ORC writer for %s\", f.type());\n}","typeGuard":null,"tryCatchPattern":"try {\n  writer = builder.primitive(iPrimitive, flinkPrimitive);\n} catch (IllegalArgumentException e) {\n  throw new SchemaMismatchException(\"Flink/Iceberg type mismatch: \" + e.getMessage(), e);\n}","preventionTips":["Keep the Flink RowType derived from the Iceberg schema (use FlinkSchemaUtil.convert)","Re-derive schemas after ALTER TABLE instead of hand-maintaining RowTypes","Pin and test your Iceberg/Flink versions together"],"tags":["flink","orc","type-mismatch"],"backgroundTag":"type-mismatch","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"}