apache/seatunnel · error · PaimonConnectorException

UNSUPPORTED_PRIMARY_DATATYPE

UNSUPPORTED_PRIMARY_DATATYPE

Error message

${cause.getMessage()}

What it means

PaimonConnectorException with code UNSUPPORTED_PRIMARY_DATATYPE, raised by resolveException (called from createTable) when Paimon rejects a primary key field whose data type is not supported. The message is taken verbatim from Paimon's UnsupportedOperationException, e.g. 'The type X in primary key field Y is unsupported'.

Solutions

  1. Change the primary key to a supported scalar type (e.g. string/int/long)
  2. Add a transform or derived column to build a supported key (e.g. concat fields into a string key)
  3. Remove table.primary-keys from config to write as an append-only table if no PK is required
  4. Cast/reduce the offending column type in the source or upstream pipeline

Example fix

// before
sink = { plugin_name="Paimon", table.primary-keys="tags", ... } // tags is array<string>
// after
sink = { plugin_name="Paimon", table.primary-keys="tag_key", ... } // transform producing a string key
Defensive patterns

Strategy: validation

Validate before calling

for (String pk : primaryKeys) {
    SeaTunnelDataType<?> t = rowType.getFieldType(pk);
    if (t.getSqlType() == SqlType.ARRAY || t.getSqlType() == SqlType.MAP
            || t.getSqlType() == SqlType.ROW) {
        throw new IllegalArgumentException("unsupported PK type for " + pk);
    }
}

Try / catch

try {
    catalog.createTable(tablePath, catalogTable, false);
} catch (PaimonConnectorException e) {
    if (e.getErrorCode() == PaimonConnectorErrorCode.UNSUPPORTED_PRIMARY_DATATYPE) {
        LOG.error("primary key type unsupported: {}", e.getMessage());
    }
}

Prevention

When it happens

Trigger: createTable on a table whose schema defines a primary key column with a type Paimon primary-key tables cannot handle (e.g. map/array/complex types as PK fields).

Common situations: Sink schema auto-mapped from source with a complex-type primary key; user configured table.primary-keys on a column of an unsupported type; schema evolution changed the PK column type.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/49e7446d86143b67. Report an issue: GitHub.

Appendix: source

Thrown at seatunnel-connectors-v2/connector-paimon/src/main/java/org/apache/seatunnel/connectors/seatunnel/paimon/catalog/PaimonCatalog.java:316

                builder.build(),
                paimonFileStoreTableTable.options(),
                partitionKeys,
                paimonFileStoreTableTable.comment().orElse(null),
                catalogName);
    }

    private Identifier toIdentifier(TablePath tablePath) {
        return Identifier.create(tablePath.getDatabaseName(), tablePath.getTableName());
    }

    private void resolveException(Exception e) {
        Throwable cause = e.getCause();
        if (cause instanceof UnsupportedOperationException) {
            String message = cause.getMessage();
            if (message.contains("The type ")
                    && message.contains(" in primary key field ")
                    && message.contains(" is unsupported")) {
                throw new PaimonConnectorException(
                        PaimonConnectorErrorCode.UNSUPPORTED_PRIMARY_DATATYPE, message);
            }
        } else if (cause instanceof RuntimeException) {
            String message = cause.getMessage();
            // https://github.com/apache/paimon/pull/3320/files#diff-d3e068ea8caf83d2371f0eaa1cbf3d02ff06e1c1cdceec5fab2e065cecd96230
            if (message.contains(
                    "Cannot define 'bucket-key' with bucket -1, please specify a bucket number.")) {
                throw new PaimonConnectorException(
                        PaimonConnectorErrorCode.WRITE_PROPS_BUCKET_KEY_ERROR, message);
            }
        }
        throw new CatalogException("An unexpected error occurred", e);
    }

    // --------------------------------------------------------------------------------------------
    // SPI load paimon catalog
    // --------------------------------------------------------------------------------------------

View on GitHub (pinned to cf67b549a7)