{"record":{"id":"49e7446d86143b67","repo":"apache/seatunnel","slug":"unsupported-primary-datatype","errorCode":"UNSUPPORTED_PRIMARY_DATATYPE","errorMessage":"${cause.getMessage()}","messagePattern":"\\$\\{cause\\.getMessage\\(\\)\\}","errorType":"error_code","errorClass":"PaimonConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-paimon/src/main/java/org/apache/seatunnel/connectors/seatunnel/paimon/catalog/PaimonCatalog.java","lineNumber":316,"sourceCode":"                builder.build(),\n                paimonFileStoreTableTable.options(),\n                partitionKeys,\n                paimonFileStoreTableTable.comment().orElse(null),\n                catalogName);\n    }\n\n    private Identifier toIdentifier(TablePath tablePath) {\n        return Identifier.create(tablePath.getDatabaseName(), tablePath.getTableName());\n    }\n\n    private void resolveException(Exception e) {\n        Throwable cause = e.getCause();\n        if (cause instanceof UnsupportedOperationException) {\n            String message = cause.getMessage();\n            if (message.contains(\"The type \")\n                    && message.contains(\" in primary key field \")\n                    && message.contains(\" is unsupported\")) {\n                throw new PaimonConnectorException(\n                        PaimonConnectorErrorCode.UNSUPPORTED_PRIMARY_DATATYPE, message);\n            }\n        } else if (cause instanceof RuntimeException) {\n            String message = cause.getMessage();\n            // https://github.com/apache/paimon/pull/3320/files#diff-d3e068ea8caf83d2371f0eaa1cbf3d02ff06e1c1cdceec5fab2e065cecd96230\n            if (message.contains(\n                    \"Cannot define 'bucket-key' with bucket -1, please specify a bucket number.\")) {\n                throw new PaimonConnectorException(\n                        PaimonConnectorErrorCode.WRITE_PROPS_BUCKET_KEY_ERROR, message);\n            }\n        }\n        throw new CatalogException(\"An unexpected error occurred\", e);\n    }\n\n    // --------------------------------------------------------------------------------------------\n    // SPI load paimon catalog\n    // --------------------------------------------------------------------------------------------\n","sourceCodeStart":298,"sourceCodeEnd":334,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-paimon/src/main/java/org/apache/seatunnel/connectors/seatunnel/paimon/catalog/PaimonCatalog.java#L298-L334","documentation":"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'.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Change the primary key to a supported scalar type (e.g. string/int/long)","Add a transform or derived column to build a supported key (e.g. concat fields into a string key)","Remove table.primary-keys from config to write as an append-only table if no PK is required","Cast/reduce the offending column type in the source or upstream pipeline"],"exampleFix":"// before\nsink = { plugin_name=\"Paimon\", table.primary-keys=\"tags\", ... } // tags is array<string>\n// after\nsink = { plugin_name=\"Paimon\", table.primary-keys=\"tag_key\", ... } // transform producing a string key","handlingStrategy":"validation","validationCode":"for (String pk : primaryKeys) {\n    SeaTunnelDataType<?> t = rowType.getFieldType(pk);\n    if (t.getSqlType() == SqlType.ARRAY || t.getSqlType() == SqlType.MAP\n            || t.getSqlType() == SqlType.ROW) {\n        throw new IllegalArgumentException(\"unsupported PK type for \" + pk);\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    catalog.createTable(tablePath, catalogTable, false);\n} catch (PaimonConnectorException e) {\n    if (e.getErrorCode() == PaimonConnectorErrorCode.UNSUPPORTED_PRIMARY_DATATYPE) {\n        LOG.error(\"primary key type unsupported: {}\", e.getMessage());\n    }\n}","preventionTips":["Only use scalar types (string/int/long/decimal) as Paimon primary keys","Build derived string keys via transform for complex columns","Validate schema PK types before submitting the job","Review Paimon docs on primary-key table type restrictions"],"tags":["paimon","primary-key","unsupported-type","schema"],"backgroundTag":"unsupported-dtype","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}