{"record":{"id":"5f94af58edb9dd16","repo":"apache/seatunnel","slug":"please-invoke-deserializationschema-deserialize-by-5f94af","errorCode":null,"errorMessage":"Please invoke DeserializationSchema#deserialize(byte[], Collector<SeaTunnelRow>) instead.","messagePattern":"Please invoke DeserializationSchema#deserialize\\(byte\\[\\], Collector<SeaTunnelRow>\\) instead\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"seatunnel-formats/seatunnel-format-json/src/main/java/org/apache/seatunnel/format/json/canal/CanalJsonDeserializationSchema.java","lineNumber":118,"sourceCode":"            String database,\n            String table,\n            boolean ignoreParseErrors) {\n        this.catalogTable = catalogTable;\n        this.seaTunnelRowType = catalogTable.getSeaTunnelRowType();\n        this.jsonDeserializer =\n                new JsonDeserializationSchema(catalogTable, false, ignoreParseErrors);\n        this.database = database;\n        this.table = table;\n        this.fieldNames = seaTunnelRowType.getFieldNames();\n        this.fieldCount = seaTunnelRowType.getTotalFields();\n        this.ignoreParseErrors = ignoreParseErrors;\n        this.databasePattern = database == null ? null : Pattern.compile(database);\n        this.tablePattern = table == null ? null : Pattern.compile(table);\n    }\n\n    @Override\n    public SeaTunnelRow deserialize(byte[] message) throws IOException {\n        throw new UnsupportedOperationException(\n                \"Please invoke DeserializationSchema#deserialize(byte[], Collector<SeaTunnelRow>) instead.\");\n    }\n\n    @Override\n    public SeaTunnelDataType<SeaTunnelRow> getProducedType() {\n        return this.seaTunnelRowType;\n    }\n\n    public void deserialize(ObjectNode jsonNode, Collector<SeaTunnelRow> out) throws IOException {\n        TablePath tablePath =\n                Optional.ofNullable(catalogTable).map(CatalogTable::getTablePath).orElse(null);\n\n        try {\n            if (database != null\n                    && !databasePattern.matcher(jsonNode.get(FIELD_DATABASE).asText()).matches()) {\n                return;\n            }\n            if (table != null","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-formats/seatunnel-format-json/src/main/java/org/apache/seatunnel/format/json/canal/CanalJsonDeserializationSchema.java#L100-L136","documentation":"CanalJsonDeserializationSchema.deserialize(byte[]) is intentionally unimplemented because a single Canal JSON message may expand into multiple SeaTunnelRow records (batched row data, multiple ops). Only the collector-based deserialize(byte[], Collector<SeaTunnelRow>) is valid, so the direct variant throws UnsupportedOperationException to enforce correct usage.","triggerScenarios":"Calling deserialize(byte[] message) directly on a CanalJsonDeserializationSchema instance, e.g. custom code or a framework path that uses the single-row API instead of the Collector overload.","commonSituations":"Writing custom consumer code that treats the format like a plain JSON deserialization schema; integrating with a runtime/translation layer that calls the byte[]-only overload; unit tests invoking the single-message API.","solutions":["Use the collector API: schema.deserialize(message, out) and read rows from the collector","If you need a single row, wrap the collector call and collect all emitted rows into a list, using the first/each as needed","Switch to a deserialization schema designed for single-row output if single-message semantics are required"],"exampleFix":"// before\nSeaTunnelRow row = canalJsonSchema.deserialize(message);\n// after\nList<SeaTunnelRow> rows = new ArrayList<>();\ncanalJsonSchema.deserialize(message, rows::add);","handlingStrategy":"type-guard","validationCode":"// Prefer the collector API; never call deserialize(byte[]) on Canal schema\ncanalJsonSchema.deserialize(message, rowCollector);","typeGuard":"// Compile-time: always bind to DeserializationSchema#deserialize(byte[], Collector)\nBiConsumer<byte[], Collector<SeaTunnelRow>> consume = canalJsonSchema::deserialize;","tryCatchPattern":"try { canalJsonSchema.deserialize(message, out); } catch (UnsupportedOperationException e) { /* wrong API used; switch to collector overload */ }","preventionTips":["Always use the Collector overload for multi-row formats (Canal/Kafka CDC)","Never call deserialize(byte[]) directly on CDC-style deserialization schemas","Check the format's Javadoc for which deserialize variant is implemented"],"tags":["json","deserialization","canal","unsupported-operation","api-misuse"],"backgroundTag":"method-not-implemented","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"}