{"record":{"id":"53db4e282982c9cd","repo":"apache/iceberg","slug":"field-d-has-unsupported-field-type-s","errorCode":null,"errorMessage":"Field %d has unsupported field type: %s","messagePattern":"Field (.+?) has unsupported field type: (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/sink/shuffle/SortKeySerializer.java","lineNumber":197,"sourceCode":"        case FIXED:\n        case BINARY:\n          byte[] bytes = record.get(i, ByteBuffer.class).array();\n          target.writeInt(bytes.length);\n          target.write(bytes);\n          break;\n        case DECIMAL:\n          BigDecimal decimal = record.get(i, BigDecimal.class);\n          byte[] decimalBytes = decimal.unscaledValue().toByteArray();\n          target.writeInt(decimalBytes.length);\n          target.write(decimalBytes);\n          target.writeInt(decimal.scale());\n          break;\n        case STRUCT:\n        case MAP:\n        case LIST:\n        default:\n          // SortKey transformation is a flattened struct without list and map\n          throw new UnsupportedOperationException(\n              String.format(\n                  Locale.ROOT, \"Field %d has unsupported field type: %s\", fieldId, typeId));\n      }\n    }\n  }\n\n  @Override\n  public SortKey deserialize(DataInputView source) throws IOException {\n    // copying is a little faster than constructing a new SortKey object\n    SortKey deserialized = lazySortKey().copy();\n    deserialize(deserialized, source);\n    return deserialized;\n  }\n\n  @Override\n  public SortKey deserialize(SortKey reuse, DataInputView source) throws IOException {\n    Preconditions.checkArgument(\n        reuse.size() == size,","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/sink/shuffle/SortKeySerializer.java#L179-L215","documentation":"SortKeySerializer.serialize throws UnsupportedOperationException when a sort-order field's transformed type is STRUCT, MAP, LIST, or any otherwise unrecognized type ID. Iceberg's sort-key shuffle feature flattens sort keys into a struct of primitive fields only; nested types cannot be serialized as flattened sort-key fields, so the serializer refuses them eagerly.","triggerScenarios":"Calling SortKeySerializer.serialize (directly or via copy/Flink's serializer machinery such as testSerializationSize) on a SortKey whose SortOrder references a source column of type struct, map, or list (or a transform whose result type is nested).","commonSituations":"Declaring an ORDER BY / sort order on a nested column (e.g. a list or map column) in the Iceberg table's sort order used by the Flink sorted-shuffle writer; passing a table with a struct-typed sort column to the sort-key shuffle operator.","solutions":["Change the table's sort order so all sort fields reference primitive-typed columns (string, int, long, etc.)","Remove the nested-typed column from the sort order, or sort by a primitive top-level column derived from it (e.g. a flattened key column)","Use a transform that yields a primitive result type for the sort field, and verify with CheckCompatibility before building the writer"],"exampleFix":"// before: sort order on a list column\nTable table = ...; table.updateSort().addSortField(icebergTypeListColumnId, SortDirection.ASC).commit();\n// after: sort by a primitive column instead\ntable.updateSort().addSortField(primitiveColumnId, SortDirection.ASC).commit();","handlingStrategy":"validation","validationCode":"import org.apache.iceberg.types.CheckCompatibility;\nimport org.apache.iceberg.SortOrder;\n// fail fast before wiring the sort-key shuffle writer\nList<Types.NestedField> fields = sortOrder.fields().stream()\n    .map(sf -> schema.findField(sf.sourceId()))\n    .collect(Collectors.toList());\nCheckCompatibility.checkFieldTypeCompatibility? // or simply:\nfor (SortField sf : sortOrder.fields()) {\n  org.apache.iceberg.types.Type t = schema.findField(sf.sourceId()).type();\n  Preconditions.checkArgument(t.isPrimitiveType(),\n      \"Sort field %s must be primitive, got %s\", sf.sourceId(), t);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only define sort orders on primitive-typed columns","Validate the SortOrder with a pre-flight check before building the Flink sink","Review table DDL: ORDER BY on nested columns is unsupported by sort-key shuffle"],"tags":["flink","unsupported-type","sort-key"],"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"}