{"record":{"id":"4c59ebd4f8146278","repo":"apache/iceberg","slug":"cannot-convert-unknown-type-to-flink","errorCode":null,"errorMessage":"Cannot convert unknown type to Flink: ","messagePattern":"Cannot convert unknown type to Flink: ","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"flink/v2.2/flink/src/main/java/org/apache/iceberg/flink/TypeToFlinkType.java","lineNumber":148,"sourceCode":"        } else {\n          // NANOS\n          return new TimestampType(9);\n        }\n      case STRING:\n        return new VarCharType(VarCharType.MAX_LENGTH);\n      case UUID:\n        // UUID length is 16\n        return new BinaryType(16);\n      case FIXED:\n        Types.FixedType fixedType = (Types.FixedType) primitive;\n        return new BinaryType(fixedType.length());\n      case BINARY:\n        return new VarBinaryType(VarBinaryType.MAX_LENGTH);\n      case DECIMAL:\n        Types.DecimalType decimal = (Types.DecimalType) primitive;\n        return new DecimalType(decimal.precision(), decimal.scale());\n      default:\n        throw new UnsupportedOperationException(\n            \"Cannot convert unknown type to Flink: \" + primitive);\n    }\n  }\n}\n","sourceCodeStart":130,"sourceCodeEnd":153,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v2.2/flink/src/main/java/org/apache/iceberg/flink/TypeToFlinkType.java#L130-L153","documentation":"TypeToFlinkType.primitive throws UnsupportedOperationException when an Iceberg primitive type has no corresponding Flink LogicalType in the switch. The message includes the unhandled primitive's toString.","triggerScenarios":"Converting an Iceberg schema containing a primitive type absent from the switch (e.g. newer types added after this Flink connector version) via FlinkSchemaUtil.convert / TypeToFlinkType.","commonSituations":"Version skew between schema producer (newer Iceberg) and flink connector (older); exotic types like UUID/variant depending on connector version; programmatically constructed schemas with unusual types.","solutions":["Upgrade iceberg-flink to a version that maps the offending type.","Replace the type in the schema with a supported one (e.g. use Types.BinaryType instead of the unknown type).","Filter/project out the unsupported columns before conversion."],"exampleFix":"// before\nSchema s = new Schema(required(1, \"v\", Types.UUIDType.get())); // unmapped in this version\n// after\nSchema s = new Schema(required(1, \"v\", Types.BinaryType.get())); // or upgrade connector","handlingStrategy":"validation","validationCode":"Set<Type> unsupported = schema.columns().stream().map(Types.NestedField::type)\n    .filter(t -> t.isPrimitiveType() && !SUPPORTED.contains(t.typeId()))\n    .collect(Collectors.toSet());\nif (!unsupported.isEmpty()) throw new IllegalStateException(\"Unmapped types: \" + unsupported);","typeGuard":"boolean flinkConvertible(Type.PrimitiveType p) { return EnumSet.of(TypeID.BOOLEAN, TypeID.INTEGER, TypeID.LONG, TypeID.FLOAT, TypeID.DOUBLE, TypeID.STRING, TypeID.DATE, TypeID.TIME, TypeID.TIMESTAMP, TypeID.BINARY, TypeID.DECIMAL).contains(p.typeId()); }","tryCatchPattern":"try { convert(schema); } catch (UnsupportedOperationException e) { /* prune or upgrade */ }","preventionTips":["Validate all primitive TypeIDs before conversion","Upgrade connector when schemas use newer types","Avoid hand-rolling exotic primitives into shared schemas"],"tags":["flink","type-conversion","unsupported-type"],"backgroundTag":"unsupported-operation","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}