{"record":{"id":"b180fa0ecfcabc83","repo":"apache/iceberg","slug":"not-a-supported-type-targettype-b180fa","errorCode":null,"errorMessage":"Not a supported type: \" + targetType","messagePattern":"Not a supported type: \" \\+ targetType","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/DataConverter.java","lineNumber":127,"sourceCode":"        };\n      case TIMESTAMP_WITHOUT_TIME_ZONE:\n        return object -> {\n          if (object instanceof Integer) {\n            LocalDateTime dateTime =\n                LocalDateTime.of(LocalDate.ofEpochDay((Integer) object), LocalTime.MIN);\n            return TimestampData.fromLocalDateTime(dateTime);\n          } else {\n            return object;\n          }\n        };\n      case ROW:\n        return new RowDataConverter((RowType) sourceType, (RowType) targetType);\n      case ARRAY:\n        return new ArrayConverter((ArrayType) sourceType, (ArrayType) targetType);\n      case MAP:\n        return new MapConverter((MapType) sourceType, (MapType) targetType);\n      default:\n        throw new UnsupportedOperationException(\"Not a supported type: \" + targetType);\n    }\n  }\n\n  static DataConverter nullable(DataConverter converter) {\n    return value -> value == null ? null : converter.convert(value);\n  }\n\n  class RowDataConverter implements DataConverter {\n    private final RowData.FieldGetter[] fieldGetters;\n    private final DataConverter[] dataConverters;\n\n    RowDataConverter(RowType sourceType, RowType targetType) {\n      this.fieldGetters = new RowData.FieldGetter[targetType.getFields().size()];\n      this.dataConverters = new DataConverter[targetType.getFields().size()];\n\n      for (int i = 0; i < targetType.getFields().size(); i++) {\n        RowData.FieldGetter fieldGetter;\n        DataConverter dataConverter;","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/DataConverter.java#L109-L145","documentation":"DataConverter.get() maps a pair of Iceberg/Flink logical types to the matching converter (struct, array, or map). When the target type's root is not one of STRUCT, ARRAY, or MAP, the default branch throws UnsupportedOperationException because no row-data conversion exists for that type.","triggerScenarios":"Calling DataConverter.get(sourceType, targetType) where targetType resolves to a primitive, varbinary, or otherwise non-nested root type in the dynamic Flink sink's schema evolution path.","commonSituations":"Writing to an Iceberg table whose schema contains a top-level column type the converter does not handle, or accidentally passing a primitive type instead of a RowType when building the dynamic sink.","solutions":["Check the target schema's root type is RowType/STRUCT before invoking get()","Extend get() with a case for the missing type if support is intended","Wrap the source data in a RowType so conversion happens at field level"],"exampleFix":"// before\nDataConverter converter = DataConverter.get(sourceType, targetPrimitiveType);\n// after\nTypes.StructType wrapped = Types.StructType.of(\n    Types.NestedField.optional(1, \"value\", targetPrimitiveType));\nDataConverter converter = DataConverter.get(\n    wrapInStruct(sourceType), wrapInStruct(wrapped));","handlingStrategy":"validation","validationCode":"if (targetType.typeId() != Types.StructType.class\n    && sourceType.typeId() != TypeID.STRUCT\n    && sourceType.typeId() != TypeID.LIST\n    && sourceType.typeId() != TypeID.MAP) {\n  throw new IllegalArgumentException(\"Unsupported root type: \" + targetType);\n}","typeGuard":"boolean isSupported(Type type) {\n  switch (type.typeId()) {\n    case STRUCT:\n    case LIST:\n    case MAP:\n      return true;\n    default:\n      return false;\n  }\n}","tryCatchPattern":null,"preventionTips":["Validate target schema root types before building the dynamic sink","Keep schemas nested under RowType/StructType for DataConverter paths"],"tags":["flink","iceberg","type-mismatch"],"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"}