Skip to content

[Bug]: data branch pick does not support decimal256 primary keys #24902

Closed

Description

@gouhongshen

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Branch Name

3.0-dev (the same data branch pick code path should also be checked on main and 4.0-dev)

Commit ID

108e4c6

Other Environment Information

Actual Behavior

data branch pick primary-key handling only covers decimal64 and decimal128 in several shared helper paths. For primary keys whose MatrixOne type is types.T_decimal256 (for example decimal(39,4)), the pick path is incomplete:

  • extractPKVal decodes T_decimal64 and T_decimal128, but not T_decimal256.
  • formatPickKeyVectorValueAsString formats T_decimal64 and T_decimal128, but not T_decimal256.
  • appendNumericStringToVec parses T_decimal64 and T_decimal128, but not T_decimal256.
  • isNumericType excludes T_decimal256.

As a result, decimal256 primary-key values cannot be reliably parsed, formatted, coerced, filtered, or compared by data branch pick. Depending on the key input path, the operation can reject the key as an unsupported PK type or use an inconsistent representation.

Expected Behavior

data branch pick should support decimal256 primary keys consistently with decimal64 and decimal128:

  • literal KEYS(...) values should parse into T_decimal256 vectors;
  • subquery key values should format/coerce T_decimal256 values correctly;
  • picked row primary-key extraction should decode T_decimal256 values correctly;
  • numeric type checks and conflict matching should include T_decimal256;
  • regression tests should cover at least one decimal(39+) primary key pick case.

Steps to Reproduce

drop database if exists test_pick_decimal256_pk;
create database test_pick_decimal256_pk;
use test_pick_decimal256_pk;

create table t0(
  d decimal(39,4) primary key,
  v int
);

insert into t0 values (12345678901234567890123456789012345.0001, 1);

data branch create table t1 from t0;
data branch create table t2 from t0;
insert into t2 values (12345678901234567890123456789012346.0002, 2);

-- Expected to pick the decimal256 PK row from t2 into t1.
data branch pick t2 into t1 keys(12345678901234567890123456789012346.0002) when conflict accept;

select * from t1 order by d;

Additional information

This is adjacent to the decimal data-branch diff fix, but should be fixed by a separate PR because it touches the pick key parsing/coercion/extraction helpers and needs its own SQL-level regression coverage.

Metadata

Metadata

Assignees

Labels

kind/bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions