apache/iceberg · error · IllegalArgumentException

Invalid iceberg type %s corresponding to Flink logical type

Error message

Invalid iceberg type %s corresponding to Flink logical type %s

What it means

FlinkOrcWriter maps Iceberg primitives to ORC writers given a Flink logical type. When the Iceberg primitive has no writer implementation in the switch, it throws IllegalArgumentException 'Invalid iceberg type %s corresponding to Flink logical type %s', identifying both types involved in the failed mapping.

Source

Thrown at flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/data/FlinkOrcWriter.java:165

          }
        case TIMESTAMP_NANO:
          Types.TimestampNanoType timestampNanoType = (Types.TimestampNanoType) iPrimitive;
          if (timestampNanoType.shouldAdjustToUTC()) {
            return FlinkOrcWriters.timestampNanoTzs();
          } else {
            return FlinkOrcWriters.timestampNanos();
          }
        case STRING:
          return FlinkOrcWriters.strings();
        case UUID:
        case FIXED:
        case BINARY:
          return GenericOrcWriters.byteArrays();
        case DECIMAL:
          Types.DecimalType decimalType = (Types.DecimalType) iPrimitive;
          return FlinkOrcWriters.decimals(decimalType.precision(), decimalType.scale());
        default:
          throw new IllegalArgumentException(
              String.format(
                  "Invalid iceberg type %s corresponding to Flink logical type %s",
                  iPrimitive, flinkPrimitive));
      }
    }
  }
}

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Upgrade iceberg-flink so the ORC writer supports the type
  2. Change the Flink-to-Iceberg converter so it produces supported types for the column
  3. Exclude the column from the write or store it as a supported type (e.g. bytes)

Example fix

// before
TIMESTAMP_WITH_LOCAL_TIME_ZONE(9) -> FlinkOrcWriter throws
// after
Use timestamp(6) logical type or upgrade the connector
Defensive patterns

Strategy: validation

Validate before calling

schema.columns().forEach(f -> { if (f.type().isPrimitiveType()) checkOrcWriterSupported(f.type().asPrimitiveType(), flinkType); });

Try / catch

try { writeOrc(table); } catch (IllegalArgumentException e) { LOG.error("ORC write failed: {}", e.getMessage()); throw e; }

Prevention

When it happens

Trigger: Writing ORC files where the table schema's Iceberg primitive cannot be mapped from the incoming Flink logical type (unsupported combination hits the default case).

Common situations: Newer Iceberg types flowing into an older Flink ORC writer; mismatched Flink LogicalType vs Iceberg type in converter configuration; module version skew.

Understand the failure class

Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/5d02cb594afebf26. Report an issue: GitHub.