{"record":{"id":"7bf86864100d93a1","repo":"apache/iceberg","slug":"unsupported-type-type-7bf868","errorCode":null,"errorMessage":"Unsupported type: ${type}","messagePattern":"Unsupported type: (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/formats/avro/RowDataToAvroConverters.java","lineNumber":223,"sourceCode":"                  } else {\n                    // Iceberg: Added support for nanoseconds precision (FLINK-39251)\n                    return instant.getEpochSecond() * 1_000_000_000L + instant.getNano();\n                  }\n                }\n              };\n        }\n        break;\n        // Iceberg: Added support for nanoseconds precision (FLINK-39251)\n      case TIMESTAMP_WITH_LOCAL_TIME_ZONE:\n        final int ltzPrecision;\n        if (type instanceof org.apache.flink.table.types.logical.LocalZonedTimestampType) {\n          ltzPrecision =\n              ((org.apache.flink.table.types.logical.LocalZonedTimestampType) type).getPrecision();\n        } else {\n          ltzPrecision = 3;\n        }\n        if (legacyTimestampMapping) {\n          throw new UnsupportedOperationException(\"Unsupported type: \" + type);\n        } else {\n          converter =\n              new RowDataToAvroConverter() {\n                private static final long serialVersionUID = 1L;\n\n                @Override\n                public Object convert(Schema schema, Object object) {\n                  TimestampData timestampData = (TimestampData) object;\n                  if (ltzPrecision <= 3) {\n                    return timestampData.getMillisecond();\n                  } else if (ltzPrecision <= 6) {\n                    return timestampData.getMillisecond() * 1000L\n                        + timestampData.getNanoOfMillisecond() / 1000;\n                  } else {\n                    // Iceberg: Added support for nanoseconds precision (FLINK-39251)\n                    return timestampData.getMillisecond() * 1_000_000L\n                        + timestampData.getNanoOfMillisecond();\n                  }","sourceCodeStart":205,"sourceCodeEnd":241,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/formats/avro/RowDataToAvroConverters.java#L205-L241","documentation":"RowDataToAvroConverters.createConverter builds RowData→Avro converters per LogicalType. TIMESTAMP_WITH_LOCAL_TIME_ZONE fields are rejected with UnsupportedOperationException when legacyTimestampMapping is true, because the legacy Avro mapping cannot represent timestamptz on write.","triggerScenarios":"Writing Flink RowData (with a TIMESTAMP_WITH_LOCAL_TIME_ZONE column) out to Avro/Iceberg while the table's avro timestamp mapping is configured as legacy (e.g. 'timestamp-without-time-zone-avro-mapping' set to legacy-micros/legacy-millis).","commonSituations":"Pipelines configured with legacy mapping properties for backward compatibility that also carry timestamptz columns; copying legacy settings from older jobs into new timestamptz-enabled writes.","solutions":["Remove the legacy timestamp-mapping table property (use the modern int64 micros mapping) so timestamptz writes are allowed.","Cast the timestamptz column to TIMESTAMP (without time zone) before writing if the legacy mapping must stay.","Drop the timestamptz column from the written schema/projection.","Use a writer/job configuration that doesn't enable legacyTimestampMapping."],"exampleFix":"// before\nDataFrame<RowData> out = in.map(row -> adjust(row)); // includes timestamptz col, legacy mapping on\n// after\nCast to timestamp-without-time-zone first, or:\ntable.updateProperties().removeProperty(\"timestamp-without-time-zone-avro-mapping\").commit();","handlingStrategy":"validation","validationCode":"if (legacyTimestampMapping && rowType.getFields().stream().anyMatch(f -> f.getType() instanceof LocalZonedTimestampType)) {\n  throw new IllegalArgumentException(\"Cannot write timestamptz with legacyTimestampMapping=true\");\n}","typeGuard":"boolean canWriteWithLegacy(LogicalType t) { return !(t instanceof LocalZonedTimestampType); }","tryCatchPattern":"try { writer.write(rowData); } catch (UnsupportedOperationException e) { // legacy mapping conflict: cast column to TimestampType or clear the mapping property }","preventionTips":["Cast timestamptz to timestamp before writing when legacy mapping is required","Remove legacy avro timestamp-mapping properties unless strictly needed","Validate the write schema against the mapping configuration at job startup"],"tags":["flink","avro","timestamp","legacy-mapping","write"],"backgroundTag":"unsupported-enum-value","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"}