{"record":{"id":"91c9a8ac98614b75","repo":"apache/iceberg","slug":"unsupported-distincttype-91c9a8","errorCode":null,"errorMessage":"Unsupported DistinctType.","messagePattern":"Unsupported DistinctType\\.","errorType":"exception","errorClass":"java.lang.UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/FlinkTypeVisitor.java","lineNumber":53,"sourceCode":"\n  @Override\n  public T visit(ZonedTimestampType zonedTimestampType) {\n    throw new UnsupportedOperationException(\"Unsupported ZonedTimestampType.\");\n  }\n\n  @Override\n  public T visit(YearMonthIntervalType yearMonthIntervalType) {\n    throw new UnsupportedOperationException(\"Unsupported YearMonthIntervalType.\");\n  }\n\n  @Override\n  public T visit(DayTimeIntervalType dayTimeIntervalType) {\n    throw new UnsupportedOperationException(\"Unsupported DayTimeIntervalType.\");\n  }\n\n  @Override\n  public T visit(DistinctType distinctType) {\n    throw new UnsupportedOperationException(\"Unsupported DistinctType.\");\n  }\n\n  @Override\n  public T visit(StructuredType structuredType) {\n    throw new UnsupportedOperationException(\"Unsupported StructuredType.\");\n  }\n\n  @Override\n  public T visit(NullType nullType) {\n    throw new UnsupportedOperationException(\"Unsupported NullType.\");\n  }\n\n  @Override\n  public T visit(RawType<?> rawType) {\n    throw new UnsupportedOperationException(\"Unsupported RawType.\");\n  }\n\n  @Override","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/FlinkTypeVisitor.java#L35-L71","documentation":"FlinkTypeVisitor throws UnsupportedOperationException for DistinctType, Flink's user-defined distinct structured type. Iceberg's type system has no equivalent, so the default visitor rejects it during schema conversion.","triggerScenarios":"Schema conversion encountering a Flink catalog column whose DataType resolves to a DistinctType (user-defined distinct type), dispatching to visit(DistinctType).","commonSituations":"Flink Catalog tables defined with user-defined DISTINCT types (e.g. CREATE DISTINCT TYPE); using a custom Flink catalog that resolves columns to distinct types.","solutions":["Replace the distinct type with its underlying base type (e.g. the wrapped VARCHAR/INT) in the schema.","Cast the column to the underlying base type before conversion.","Subclass FlinkTypeVisitor and override visit(DistinctType) to delegate to the source type's conversion.","Avoid using Flink DISTINCT types in Iceberg-backed tables."],"exampleFix":"// before\nCREATE DISTINCT TYPE email AS VARCHAR(320);\ncol 'contact' email\n\n// after\ncol 'contact' VARCHAR(320)","handlingStrategy":"validation","validationCode":"for (Column col : resolvedSchema.getColumns()) {\n  if (col.getDataType().getLogicalType() instanceof DistinctType) {\n    throw new IllegalArgumentException(\"Column '\" + col.getName() + \"' uses a Flink DISTINCT type; use the base type\");\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  Schema s = FlinkSchemaUtil.toIcebergSchema(flinkSchema);\n} catch (UnsupportedOperationException e) {\n  if (e.getMessage().contains(\"DistinctType\")) {\n    // replace distinct types with their base types\n  } else {\n    throw e;\n  }\n}","preventionTips":["Avoid Flink DISTINCT types in Iceberg-backed tables; use base types.","Flatten UDTs to scalar columns before conversion.","Pre-validate catalog schemas before table creation."],"tags":["flink","type-mapping","udt","unsupported"],"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"}