{"record":{"id":"7062b85452728377","repo":"apache/iceberg","slug":"unhandled-type-7062b8","errorCode":null,"errorMessage":"Unhandled type ","messagePattern":"Unhandled type ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"orc/src/main/java/org/apache/iceberg/orc/ORCSchemaUtil.java","lineNumber":261,"sourceCode":"      case MAP:\n        {\n          Types.MapType map = (Types.MapType) type;\n\n          // Only the value can be set as an unknown by definition:\n          // UnknownType requires to be optional, and the key has to be required.\n          Preconditions.checkArgument(\n              map.valueType().typeId() != Type.TypeID.UNKNOWN,\n              \"Cannot create MapType with unknown value type\");\n\n          TypeDescription keyType = convert(map.keyId(), map.keyType(), true);\n\n          TypeDescription valueType =\n              convert(map.valueId(), map.valueType(), map.isValueRequired());\n          orcType = TypeDescription.createMap(keyType, valueType);\n          break;\n        }\n      default:\n        throw new IllegalArgumentException(\"Unhandled type \" + type.typeId());\n    }\n\n    // Set Iceberg column attributes for mapping\n    orcType.setAttribute(ICEBERG_ID_ATTRIBUTE, String.valueOf(fieldId));\n    orcType.setAttribute(ICEBERG_REQUIRED_ATTRIBUTE, String.valueOf(isRequired));\n    return orcType;\n  }\n\n  /**\n   * Convert an ORC schema to an Iceberg schema. This method handles the conversion from the\n   * original Iceberg column mapping IDs if present in the ORC column attributes, otherwise, ORC\n   * columns with no Iceberg IDs will be ignored and skipped in the conversion.\n   *\n   * @return the Iceberg schema\n   * @throws IllegalArgumentException if ORC schema has no columns with Iceberg ID attributes\n   */\n  public static Schema convert(TypeDescription orcSchema) {\n    List<TypeDescription> children = orcSchema.getChildren();","sourceCodeStart":243,"sourceCodeEnd":279,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/orc/src/main/java/org/apache/iceberg/orc/ORCSchemaUtil.java#L243-L279","documentation":"ORCSchemaUtil.convert maps Iceberg Types to ORC TypeDescriptions. The switch over type.typeId() has no ORC equivalent branch for every Iceberg type (e.g. unknown/future or non-primitive nested typeIds reach the default arm), so an IllegalArgumentException naming the typeId is thrown. Callers convert(...) recurse through childType/elementType/keyType/valueType and buildOrcProjection, so the error surfaces while building the ORC schema or projection.","triggerScenarios":"Calling ORCSchemaUtil.convert(schema/spec projection) when the Iceberg schema contains a type whose typeId has no case in the conversion switch (e.g. newer Iceberg types added after the ORC mapping was written, or a nested schema element that reaches the default arm).","commonSituations":"Writing ORC files for a table with a type added in a newer Iceberg spec than the ORC mapping supports; version mismatch between Iceberg versions when a schema was created elsewhere (Spark/Flink) with types not mapped in ORC; feeding a synthetic/unknown Type to the converter.","solutions":["Inspect the typeId in the message and rewrite the schema so it only uses ORC-supported Iceberg types (primitive types, struct, list, map).","Upgrade the Iceberg ORC module so the conversion switch covers the type you use.","If the type is genuinely unmappable, change the table schema or fall back to a different file format (Parquet/Avro) that supports it."],"exampleFix":"// before\nSchema schema = new Schema(\n    Types.NestedField.required(1, \"u\", Types.UnknownType.get())); // unsupported in ORC\nTypeDescription orc = ORCSchemaUtil.convert(schema);\n\n// after\nSchema schema = new Schema(\n    Types.NestedField.required(1, \"s\", Types.StringType.get())); // mapped type\nTypeDescription orc = ORCSchemaUtil.convert(schema);","handlingStrategy":"validation","validationCode":"for (Types.NestedField f : schema.columns()) {\n  switch (f.type().typeId()) {\n    case BOOLEAN: case INT: case LONG: case FLOAT: case DOUBLE: case DATE:\n    case TIME: case TIMESTAMP: case STRING: case UUID: case FIXED: case BINARY:\n    case DECIMAL: case STRUCT: case LIST: case MAP:\n      break;\n    default:\n      throw new IllegalArgumentException(\"Type not ORC-mappable: \" + f.type());\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  TypeDescription orc = ORCSchemaUtil.convert(schema);\n} catch (IllegalArgumentException e) {\n  LOG.error(\"Unmappable Iceberg type for ORC: {}\", e.getMessage());\n  throw e;\n}","preventionTips":["Keep table schemas within ORC-supported Iceberg types","Validate schemas before creating ORC tables in mixed-engine environments","Upgrade the ORC module when using newly added Iceberg types"],"tags":["java","orc","schema","type-mapping"],"backgroundTag":"incompatible-source-type","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"}