{"record":{"id":"4b96aa4feef0cf58","repo":"apache/seatunnel","slug":"common-unsupported-operation-4b96aa","errorCode":"COMMON_UNSUPPORTED_OPERATION","errorMessage":"unsupported row kind: ","messagePattern":"unsupported row kind: ","errorType":"error_code","errorClass":"JdbcConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/executor/InsertOrUpdateBatchStatementExecutor.java","lineNumber":160,"sourceCode":"            }\n        }\n    }\n\n    private boolean upsertMode() {\n        return existStmtFactory != null;\n    }\n\n    private boolean existRow(SeaTunnelRow record) throws SQLException {\n        if (upsertMode()) {\n            return exist(keyExtractor.apply(record));\n        }\n        switch (record.getRowKind()) {\n            case INSERT:\n                return false;\n            case UPDATE_AFTER:\n                return true;\n            default:\n                throw new JdbcConnectorException(\n                        CommonErrorCodeDeprecated.UNSUPPORTED_OPERATION,\n                        \"unsupported row kind: \" + record.getRowKind());\n        }\n    }\n\n    private boolean exist(SeaTunnelRow pk) throws SQLException {\n        rowConverter.toExternal(keyTableSchema, databaseTableSchema, pk, existStatement);\n        try (ResultSet resultSet = existStatement.executeQuery()) {\n            return resultSet.next();\n        }\n    }\n}\n","sourceCodeStart":142,"sourceCodeEnd":173,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/executor/InsertOrUpdateBatchStatementExecutor.java#L142-L173","documentation":"InsertOrUpdateBatchStatementExecutor.existRow decides whether an incoming row requires an INSERT or an UPDATE based on its RowKind. Only INSERT (no existing row) and UPDATE_AFTER (row exists) are supported; any other RowKind (DELETE_BEFORE, DELETE_AFTER, UPDATE_BEFORE) reaches the default branch and throws this error.","triggerScenarios":"A CDC stream (e.g. MySQL/Debezium) delivers UPDATE_BEFORE or DELETE events into a JDBC sink configured with insert/update (upsert via exist-check) mode.","commonSituations":"Sink receives full change-log including delete/update-before events; misconfigured CDC option that does not filter events; using the insertOrUpdate executor with a stream containing tombstones.","solutions":["Filter out UPDATE_BEFORE/DELETE rows before the sink (e.g. use a filter transform or configure the source to emit only UPDATE_AFTER).","Use an upsert dialect (e.g. ON CONFLICT / ON DUPLICATE KEY) instead of the exist-check executor so all row kinds are handled.","Enable delete support in the sink config if deletes must be applied.","Verify the source's produce-CHANGE-EVENT setting matches the sink's expectations."],"exampleFix":"// before: raw CDC stream to jdbc insertOrUpdate sink\n// after: filter unsupported row kinds upstream\nsource {\n  MySQL-CDC { ... }\n}\nfilter {\n  # drop UPDATE_BEFORE / DELETE events\n}","handlingStrategy":"validation","validationCode":"// before the sink, drop unsupported row kinds\nrows.removeIf(r -> r.getRowKind() != RowKind.INSERT && r.getRowKind() != RowKind.UPDATE_AFTER);","typeGuard":"boolean isUpsertSafeRowKind(RowKind k) {\n  return k == RowKind.INSERT || k == RowKind.UPDATE_AFTER;\n}","tryCatchPattern":"try {\n  executor.executeBatch();\n} catch (JdbcConnectorException e) {\n  if (CommonErrorCodeDeprecated.UNSUPPORTED_OPERATION.equals(e.getErrorCode())) {\n    // switch to a dialect-based upsert sink or filter CDC events upstream\n  }\n  throw e;\n}","preventionTips":["Filter CDC streams to INSERT/UPDATE_AFTER before JDBC sinks that don't handle deletes.","Prefer dialect-native upsert (ON CONFLICT / ON DUPLICATE KEY) over exist-check executors.","Enable sink delete support explicitly if DELETE events must be applied.","Review source CHANGE-EVENT emission settings for compatibility."],"tags":["jdbc","rowkind","cdc","upsert"],"backgroundTag":"unsupported-enum-value","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}