apache/iceberg · warning

Record schema of type

Error message

Record schema of type {} does not match table of type {}

What it means

RecordConverter.evolveSchemaFromConnectSchema logs a warning when the Kafka Connect record's field type does not match the corresponding Iceberg table column type, so automatic schema evolution cannot be applied for that field. The field is skipped rather than evolved, and data may be written with the existing table type or fail downstream conversion.

Solutions

  1. Alter the Iceberg table schema so the column type matches the record schema
  2. Adjust the upstream producer to emit the type the table expects
  3. Use a schema transformation/message converter in Connect to coerce the record type
  4. Check handling of logical types (timestamp/decimal) in the Connect schema — set appropriate config (e.g. timestamp conversion)

Example fix

// before: table column `count` is long, record schema type is int32 -> warning
// after: evolve table to match
// Spark: ALTER TABLE catalog.db.t ALTER COLUMN count TYPE long; or set count to int in the producer
Defensive patterns

Strategy: validation

Validate before calling

org.apache.kafka.connect.data.Schema.Type connectType = recordSchema.field(name).schema().type();
Type icebergType = table.schema().findField(name).type();
if (!RecordConverter.matches(connectType, icebergType)) { /* fix table or producer schema before writing */ }

Prevention

When it happens

Trigger: Writing records via IcebergWriter with schema evolution (evolve-schema enabled) where a Connect field type (e.g. int, timestamp) does not correspond to the declared Iceberg type (e.g. table has long or string where record has int32).

Common situations: Producer changed a field's type (int -> long, string -> timestamp); table schema was manually altered; Connect schema inference derives a different logical type than the table's.

Understand the failure class

Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.

Related errors


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

Appendix: source

Thrown at kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/data/RecordConverter.java:361

        if (tableType.isMapType()) {
          MapType mapType = tableType.asMapType();
          evolveSchemaFromConnectSchema(
              recordSchema.valueSchema(),
              mapType.valueType(),
              mapType.valueId(),
              schemaUpdateConsumer);
        } else {
          logMismatchedType(recordSchema.type(), tableType);
        }
        break;
      default:
        break;
    }
  }

  private void logMismatchedType(
      org.apache.kafka.connect.data.Schema.Type recordSchemaType, Type tableType) {
    LOG.warn(
        "Record schema of type {} does not match table of type {}", recordSchemaType, tableType);
  }

  private NestedField lookupStructField(String fieldName, StructType schema, int structFieldId) {
    if (nameMapping == null) {
      return config.schemaCaseInsensitive()
          ? schema.caseInsensitiveField(fieldName)
          : schema.field(fieldName);
    }

    return structNameMap
        .computeIfAbsent(structFieldId, notUsed -> createStructNameMap(schema))
        .get(fieldName);
  }

  private Map<String, NestedField> createStructNameMap(StructType schema) {
    Map<String, NestedField> map = Maps.newHashMap();
    schema

View on GitHub (pinned to 86d9c8fc54)