{"record":{"id":"33afa8b76eac7403","repo":"apache/iceberg","slug":"unsupported-nulltype-33afa8","errorCode":null,"errorMessage":"Unsupported NullType.","messagePattern":"Unsupported NullType\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"flink/v2.2/flink/src/main/java/org/apache/iceberg/flink/FlinkTypeVisitor.java","lineNumber":63,"sourceCode":"\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\n  public T visit(SymbolType<?> symbolType) {\n    throw new UnsupportedOperationException(\"Unsupported SymbolType.\");\n  }\n\n  @Override\n  public T visit(LogicalType other) {\n    throw new UnsupportedOperationException(\"Unsupported type: \" + other);\n  }\n}\n","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v2.2/flink/src/main/java/org/apache/iceberg/flink/FlinkTypeVisitor.java#L45-L81","documentation":"FlinkTypeVisitor.visit(NullType) throws UnsupportedOperationException because Iceberg schemas have no NULL-typed column. Flink's NULL type (from untyped NULL literals or unresolved casts) cannot map to any Iceberg type.","triggerScenarios":"Converting a schema where a column's DataType is the NULL type — commonly from `CAST(NULL AS ...)` without a target type, untyped UDF results, or `NULL` literals in a VALUES/table definition.","commonSituations":"Pipelines inserting constant NULL columns into Iceberg sinks without explicit casts; schema inference producing NullType for empty/unknown sources.","solutions":["Add an explicit cast: `CAST(NULL AS STRING)` (or the intended concrete type).","Declare the column with a concrete type in the DDL instead of relying on inference.","Ensure UDFs declare concrete result types (getResultType / DataType hints)."],"exampleFix":"// before\nINSERT INTO t SELECT NULL AS flag FROM src;\n// after\nINSERT INTO t SELECT CAST(NULL AS BOOLEAN) AS flag FROM src;","handlingStrategy":"type-guard","validationCode":"if (dataType.getLogicalType() instanceof NullType) {\n  throw new IllegalArgumentException(\"Cast NULL literals to a concrete type before Iceberg write\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always cast NULL literals in INSERT ... SELECT projections.","Give UDFs concrete result types so inference does not yield NullType."],"tags":["flink","type-mapping","null-type"],"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-23T08:17:48.524Z"}