{"record":{"id":"41b2bda91f1d0b0f","repo":"apache/iceberg","slug":"unsupported-nulltype","errorCode":null,"errorMessage":"Unsupported NullType.","messagePattern":"Unsupported NullType\\.","errorType":"exception","errorClass":"java.lang.UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"flink/v1.20/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/v1.20/flink/src/main/java/org/apache/iceberg/flink/FlinkTypeVisitor.java#L45-L81","documentation":"Flink NullType represents a column whose type is unknown/null (e.g. an untyped NULL literal). It has no Iceberg equivalent, so FlinkTypeVisitor throws UnsupportedOperationException when conversion reaches it. Iceberg requires every field to have a concrete type.","triggerScenarios":"Converting a row type containing a NULL literal column without an explicit cast (SELECT NULL AS c), or a connector emitting NullType columns, when the schema is converted via FlinkTypeVisitor for an Iceberg sink.","commonSituations":"INSERT INTO iceberg_table SELECT NULL AS some_col, ... where Flink infers NullType; UDFs returning untyped nulls; dynamic tables built from generic objects where a field type resolves to NullType.","solutions":["Add an explicit cast to the null literal: SELECT CAST(NULL AS STRING) AS some_col.","Declare the column with a concrete type in the Table API, e.g. DataTypes.STRING().nullable().","Remove the always-null column from the sink schema or replace it with a typed default.","Override visit(NullType) in a custom visitor if you want a specific default mapping."],"exampleFix":"// before\nINSERT INTO iceberg_t SELECT NULL AS note FROM src;\n// after\nINSERT INTO iceberg_t SELECT CAST(NULL AS STRING) AS note FROM src;","handlingStrategy":"validation","validationCode":"import org.apache.flink.table.types.logical.LogicalType;\nimport org.apache.flink.table.types.logical.NullType;\n\nstatic boolean containsNullType(org.apache.flink.table.api.Schema schema) {\n  return schema.getColumns().stream()\n      .anyMatch(c -> c.getType().getLogicalType() instanceof NullType);\n}","typeGuard":"static boolean isNullType(LogicalType t) {\n  return t instanceof NullType;\n}","tryCatchPattern":null,"preventionTips":["Always cast NULL literals: CAST(NULL AS STRING); never SELECT NULL AS col into Iceberg.","Declare Table API columns with explicit DataTypes on a concrete type.","Make UDF type information explicit rather than relying on null inference.","Add a pre-submit schema validation that rejects NullType columns."],"tags":["flink","iceberg","unsupported-type","null-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-14T16:17:12.679Z"}