{"record":{"id":"a03583753f0fdc8a","repo":"apache/iceberg","slug":"unsupported-nulltype-a03583","errorCode":null,"errorMessage":"Unsupported NullType.","messagePattern":"Unsupported NullType\\.","errorType":"exception","errorClass":"java.lang.UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"flink/v2.1/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.1/flink/src/main/java/org/apache/iceberg/flink/FlinkTypeVisitor.java#L45-L81","documentation":"Type-visitor guard in FlinkTypeVisitor: the Flink NullType has no meaningful Iceberg representation in this conversion path (unlike the schema conversion that can map it to void/unknown), so visiting it during read/write planning fails. It indicates the Flink schema contains an untyped null column.","triggerScenarios":"Converting a Flink RowType that includes NullType columns, commonly produced by SELECT NULL, VALUES with all NULLs, or UDFs returning NullType.","commonSituations":"Insert pipelines that emit NULL literals without casts; dynamic SQL generating untyped NULL columns that end up in an Iceberg sink schema.","solutions":["Add an explicit CAST to the NULL expression (e.g. CAST(NULL AS STRING)) in the SQL","Declare the column type explicitly in the sink DDL instead of relying on inference","Replace NullType columns with a concrete nullable primitive type in the RowType"],"exampleFix":"// before\nSELECT NULL AS flag -- NullType column -> throws\n// after\nSELECT CAST(NULL AS STRING) AS flag","handlingStrategy":"validation","validationCode":"List<String> nullCols = rowType.getFields().stream()\n  .filter(f -> f.getType() instanceof NullType)\n  .map(RowType.RowField::getName)\n  .collect(Collectors.toList());\nif (!nullCols.isEmpty()) throw new IllegalArgumentException(\"Cast NULL columns: \" + nullCols);","typeGuard":"boolean isSupported(LogicalType t) {\n  return !(t instanceof NullType);\n}","tryCatchPattern":null,"preventionTips":["Always CAST(NULL AS <type>) in SQL projections feeding Iceberg sinks","Declare explicit column types in sink DDL","Enable type checks in CI on generated schemas"],"tags":["flink","type-conversion","null-type"],"backgroundTag":"type-mismatch","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"}