{"record":{"id":"44bad8a803e39715","repo":"apache/iceberg","slug":"invalid-iceberg-type-s-corresponding-to-orc-type-44bad8","errorCode":null,"errorMessage":"Invalid iceberg type %s corresponding to ORC type %s","messagePattern":"Invalid iceberg type (.+?) corresponding to ORC type (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":400,"severity":"error","filePath":"orc/src/main/java/org/apache/iceberg/data/orc/GenericOrcWriter.java","lineNumber":134,"sourceCode":"          Types.TimestampNanoType timestampNanoType = (Types.TimestampNanoType) iPrimitive;\n          if (timestampNanoType.shouldAdjustToUTC()) {\n            return GenericOrcWriters.timestampTzNanos();\n          } else {\n            return GenericOrcWriters.timestampNanos();\n          }\n        case STRING:\n          return GenericOrcWriters.strings();\n        case UUID:\n          return GenericOrcWriters.uuids();\n        case FIXED:\n          return GenericOrcWriters.byteArrays();\n        case BINARY:\n          return GenericOrcWriters.byteBuffers();\n        case DECIMAL:\n          Types.DecimalType decimalType = (Types.DecimalType) iPrimitive;\n          return GenericOrcWriters.decimal(decimalType.precision(), decimalType.scale());\n        default:\n          throw new IllegalArgumentException(\n              String.format(\n                  \"Invalid iceberg type %s corresponding to ORC type %s\", iPrimitive, primitive));\n      }\n    }\n  }\n\n  @Override\n  public void write(Record value, VectorizedRowBatch output) {\n    Preconditions.checkArgument(value != null, \"value must not be null\");\n    writer.writeRow(value, output);\n  }\n\n  @Override\n  public List<OrcValueWriter<?>> writers() {\n    return writer.writers();\n  }\n\n  @Override","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/orc/src/main/java/org/apache/iceberg/data/orc/GenericOrcWriter.java#L116-L152","documentation":"GenericOrcWriter.primitive() throws IllegalArgumentException when an Iceberg primitive type has no corresponding ORC writer mapping in the current branch (expected e.g. BINARY->byteBuffers, DECIMAL->decimal; anything else is invalid for writing).","triggerScenarios":"Writing data to ORC data files where a column's Iceberg primitive type is not supported by the writer mapping (e.g., writing a TIMESTAMP_NTZ or UUID variant not handled in that branch).","commonSituations":"Writing tables with newly introduced Iceberg types using an older Iceberg ORC writer; appends with schemas containing types ORC support doesn't cover in this code path.","solutions":["Upgrade Iceberg to a version whose GenericOrcWriter supports the type.","Change the column type to one supported by the ORC writer (e.g., use binary or long).","Write those columns as a supported type or store them serialized.","Use a different file format (Parquet/Avro) that supports the type for this table."],"exampleFix":"// before\nschema: uuid_col UUID -- GenericOrcWriter has no mapping -> IllegalArgumentException\n// after\nALTER TABLE ... ALTER COLUMN uuid_col TYPE BINARY; // store as bytes","handlingStrategy":"validation","validationCode":"// ensure the type is writable to ORC\nif (!(iPrimitive instanceof Types.BinaryType || iPrimitive instanceof Types.DecimalType /* ...supported set */)) {\n  throw new IllegalArgumentException(\"not writable to ORC: \" + iPrimitive);\n}","typeGuard":"boolean writableToOrc = SUPPORTED_PRIMITIVES.contains(iPrimitive.typeId());","tryCatchPattern":null,"preventionTips":["Check supported ORC writer mappings before choosing column types","Use Parquet/Avro for types ORC does not support","Keep Iceberg versions current","Test appends with the full schema before production"],"tags":["orc","writer","unsupported-type","schema"],"backgroundTag":"unsupported-operation","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"}