Skip to content

[Bug]: DATA BRANCH DIFF fails on JSON, BIT and BLOB when saving query results #31534

Open

Description

@Ariznawlll

Description

DATA BRANCH DIFF fails when save_query_result is enabled and the changed row contains a JSON, BIT, or binary BLOB column. The same diff returns the correct changed row when result saving is disabled. The error prevents inspecting branch changes; the source and branch remain unchanged.

Environment

  • MatrixOne main: f847803802289b2b2d0df4f0a2f842c2804b823a (git_version() = f847803802)
  • Isolated local standalone, one CN, macOS arm64

Reproduction

CREATE DATABASE branch_json_repro;
USE branch_json_repro;
CREATE TABLE base (id INT PRIMARY KEY, value JSON);
INSERT INTO base VALUES (1, '{"a":1}');
DATA BRANCH CREATE TABLE child FROM base;
UPDATE child SET value = '{"a":2}' WHERE id = 1;

SET save_query_result = OFF;
DATA BRANCH DIFF child AGAINST base;
-- child, UPDATE, 1, {"a": 2}

SET save_query_result = ON;
DATA BRANCH DIFF child AGAINST base;
-- ERROR 20101: internal error: unsupported mysql type 245

DATA BRANCH DIFF child AGAINST base OUTPUT COUNT; -- 1
SELECT 1; -- succeeds

The same steps with value BIT(64) (b'1' → b'0') fail with unsupported mysql type 16; with value BLOB (X'00' → X'FF') they fail with unsupported mysql type 252.

Expected

Enabling result saving should not prevent a supported diff from returning or saving the changed rows. The saved result should preserve the original values and types.

Validation

Reproduced 3/3 in freshly created databases (qbranchmatrix_04, _05, _06). In every round JSON, BIT and BLOB returned their expected updated values with saving OFF and the listed errors with saving ON; OUTPUT COUNT returned 1 and the session remained usable. UUID, VECF32, VARBINARY, DECIMAL, TIMESTAMP and ENUM controls succeeded with saving ON. A separate mixed-type run confirmed OUTPUT AS and the source/branch data were unaffected. Only the standalone setup was tested.

Code analysis

satisfyDiffOutputOpt passes the diff result to trySaveQueryResult. mysqlColDef2PlanResultColDef lacks mappings for JSON, BIT and binary BLOB wire types and returns the observed error. This missing mapping is distinct from #31498's unsigned-value type assertion panic.

Metadata

Metadata

Assignees

Labels

kind/bugneeds-triage

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions