{"record":{"id":"2c0fb9cade7370b6","repo":"apache/iceberg","slug":"unsupported-logical-type-2c0fb9","errorCode":null,"errorMessage":"Unsupported logical type: ","messagePattern":"Unsupported logical type: ","errorType":"exception","errorClass":"java.lang.UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/data/FlinkParquetWriters.java","lineNumber":193,"sourceCode":"    }\n\n    private ParquetValueWriter<?> newOption(Type fieldType, ParquetValueWriter<?> writer) {\n      int maxD = type.getMaxDefinitionLevel(path(fieldType.getName()));\n      return ParquetValueWriters.option(fieldType, maxD, writer);\n    }\n\n    @Override\n    public ParquetValueWriter<?> primitive(LogicalType fType, PrimitiveType primitive) {\n      ColumnDescriptor desc = type.getColumnDescription(currentPath());\n\n      LogicalTypeAnnotation annotation = primitive.getLogicalTypeAnnotation();\n      if (annotation != null) {\n        Optional<ParquetValueWriter<?>> writer =\n            annotation.accept(new LogicalTypeWriterBuilder(fType, desc));\n        if (writer.isPresent()) {\n          return writer.get();\n        } else {\n          throw new UnsupportedOperationException(\n              \"Unsupported logical type: \" + primitive.getOriginalType());\n        }\n      }\n\n      switch (primitive.getPrimitiveTypeName()) {\n        case FIXED_LEN_BYTE_ARRAY:\n        case BINARY:\n          return byteArrays(desc);\n        case BOOLEAN:\n          return ParquetValueWriters.booleans(desc);\n        case INT32:\n          return ints(fType, desc);\n        case INT64:\n          return ParquetValueWriters.longs(desc);\n        case FLOAT:\n          return ParquetValueWriters.floats(desc);\n        case DOUBLE:\n          return ParquetValueWriters.doubles(desc);","sourceCodeStart":175,"sourceCodeEnd":211,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/data/FlinkParquetWriters.java#L175-L211","documentation":"In FlinkParquetWriters, primitive(...) first asks LogicalTypeWriterBuilder (a LogicalTypeAnnotationVisitor) to handle columns carrying a Parquet logical type annotation. If the annotation is present but visit() returns Optional.empty() — i.e. the annotation is not one the writer builder knows — the code throws UnsupportedOperationException naming the original Parquet type.","triggerScenarios":"Writing Flink data to Parquet where a column's Parquet type has a logical annotation that LogicalTypeWriterBuilder does not implement (e.g. less common annotations like ENUM, JSON, BSON, INTERVAL, or unknown/future annotations).","commonSituations":"Schema converted from a source format that produced exotic Parquet logical types; newer Parquet annotation types written by other engines; mis-mapped Flink types that yielded unexpected annotations.","solutions":["Inspect the file schema (parquet-tools/meta) to identify the offending annotation on the column.","Adjust the write schema so the column uses a supported annotated type (e.g. standard decimal, timestamp, string/uuid-style annotations Iceberg supports).","If the annotation should be supported, add a visit(...) case to LogicalTypeWriterBuilder and return an appropriate writer."],"exampleFix":"// before: column annotated as ENUM (unsupported by visitor)\n// after: write the column as a plain required/optional BINARY or STRING type","handlingStrategy":"validation","validationCode":"// java\nLogicalTypeAnnotation ann = column.getPrimitiveType().getLogicalTypeAnnotation();\nboolean supported = ann == null || ann.accept(new LogicalTypeAnnotationVisitor<Boolean>() {\n  public Optional<Boolean> visit(DecimalLogicalTypeAnnotation d) { return Optional.of(true); }\n  public Optional<Boolean> visit(TimestampLogicalTypeAnnotation t) { return Optional.of(true); }\n  // return Optional.empty() for anything else\n});","typeGuard":null,"tryCatchPattern":"// java\ntry {\n  writer = FlinkParquetWriters.write(compatibleSchema, rowType, outputFactory);\n} catch (UnsupportedOperationException e) {\n  throw new IllegalStateException(\"Column uses unsupported Parquet logical type; fix write schema\", e);\n}","preventionTips":["Build write schemas through Iceberg types so annotations stay within supported sets.","Avoid copying Parquet schemas verbatim from other engines.","Add a LogicalTypeAnnotationVisitor dry-run over the file schema before opening the writer."],"tags":["flink","parquet","writer","logical-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"}