{"record":{"id":"543026f3173d664d","repo":"apache/iceberg","slug":"unsupported-nulltype-543026","errorCode":null,"errorMessage":"Unsupported NullType.","messagePattern":"Unsupported NullType\\.","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":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.3/flink/src/main/java/org/apache/iceberg/flink/FlinkTypeVisitor.java#L45-L81","documentation":"Type-visitor guard in FlinkTypeVisitor: a Flink NullType column reached schema traversal. NullType has no Iceberg counterpart in this conversion, so the visitor refuses it — the Flink DDL/schema contains a column with only the null type.","triggerScenarios":"Schema conversion encountering a column or expression typed as NULL, e.g. 'CAST(NULL AS ...)' missing, or a table defined with a NULL-typed column, dispatching to visit(NullType).","commonSituations":"SELECT NULL AS col in an INSERT INTO Iceberg table without a cast; dynamically derived schemas from statements where all values are NULL.","solutions":["Add an explicit cast: CAST(NULL AS STRING) (or the target type) in the query.","Declare a concrete column type in the DDL instead of relying on inferred NULL type.","Subclass FlinkTypeVisitor and override visit(NullType) to map to a chosen default Iceberg type.","Ensure upstream schema inference produces concrete types (e.g. via table schema definitions, not expression inference)."],"exampleFix":"// before\nINSERT INTO t SELECT NULL AS extra_col FROM src;\n\n// after\nINSERT INTO t SELECT CAST(NULL AS STRING) AS extra_col FROM src;","handlingStrategy":"validation","validationCode":"for (Column col : resolvedSchema.getColumns()) {\n  if (col.getDataType().getLogicalType() instanceof NullType) {\n    throw new IllegalArgumentException(\"Column '\" + col.getName() + \"' is NULL-typed; declare a concrete type\");\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  Schema s = FlinkSchemaUtil.toIcebergSchema(flinkSchema);\n} catch (UnsupportedOperationException e) {\n  if (e.getMessage().contains(\"NullType\")) {\n    // add CAST(NULL AS <type>) in the producing query\n  } else {\n    throw e;\n  }\n}","preventionTips":["Always cast NULL literals to a concrete type in SELECT lists.","Declare explicit column types in DDLs instead of relying on inference.","Review dynamic schema-inference queries for pure-NULL expressions."],"tags":["flink","type-mapping","null-type","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"}