Skip to content

[Bug]: DATA BRANCH cannot materialize VECUINT8 values #26136

Closed

Description

@Ariznawlll

Summary

DATA BRANCH cannot materialize a VECUINT8 value. The row extraction path produces the value as a display string, while the Data Branch value formatter assumes a []uint8 value.

Reproduction

This was reproduced three times on origin/main at 3f3cdcdda64fddb93b6668a301ff38d41e73fb76 with a focused white-box test:

  1. Build a T_array_uint8 vector containing [1, 2, 3].
  2. Pass the cell through extractDataBranchSQLRowValue.
  3. Pass the extracted row value and its original type to formatValIntoString.

The formatter terminates at the T_array_uint8 branch because the extracted value is a string, not []uint8.

Expected behavior

The Data Branch row-materialization path should emit a valid SQL literal for VECUINT8, consistent with the other narrow vector types, so a branch operation can apply the row successfully.

Actual behavior

The value-shape mismatch stops formatting before the row can be applied.

Relevant flow

extractDataBranchSQLRowValue -> extractRowFromVector -> formatValIntoString

The dedicated frontend extraction test already documents that VECUINT8 is represented as a display string for row-oriented consumers, while the newly added formatter branch asserts []uint8.

Activity

  1. added this to the MO-202607 milestone on Jul 24, 2026
  2. added
    kind/bug
    on Jul 24, 2026
  3. added theissue type on Jul 24, 2026
  4. added a commit that references this issue on Jul 27, 2026
    f9c1419
  5. VioletQwQ-0 commented on Jul 29, 2026

    @VioletQwQ-0
    Collaborator

    PR #26148 merged as f9c14192a035a31731622df8c1076b77d31121bb (reviewed head 210d1de0971bd5c8f4eda7b0f06b27a853a5c1a4). The exact-head regressions cover raw VECUINT8 materialization and const-NULL safety; required CI completed sufficiently for merge.

    QA handoff on main f6dab28046d70412cec132f0068840896852101c:

    • Create DATA BRANCH copies containing ordinary, empty, NULL, and repeated const-NULL VECUINT8 values.
    • Verify multiple logical rows, including a nonzero row index, and read the destination data back.
    • Verify no panic and no string/display-format corruption.

    Pass: all values preserve source semantics and NULLs remain NULL. Fail: panic, malformed SQL, wrong bytes, or NULL/empty conflation.

  6. Ariznawlll commented on Jul 29, 2026

    @Ariznawlll
    CollaboratorAuthor

    已在最新 main 分支完成验证。

    测试版本:52ea9f874f492c368a20efef16b46ab8ced2de37
    测试拓扑:Proxy + 2 CN

    测试过程:

    1. 执行 VECUINT8 提取、格式化及 const-NULL 专项测试,普通模式和 -race 模式各连续 3 轮。
    2. 黑盒覆盖六种向量类型:
      • VECF32
      • VECF64
      • VECBF16
      • VECF16
      • VECINT8
      • VECUINT8
    3. 每种类型均覆盖普通值、边界值、NULL、非零行号、UPDATE、INSERT 和 DELETE。
    4. 依次执行 Data Branch CREATE、DIFF、选择性 PICK 和 MERGE,并回读源/目标数据对比。

    测试结果:

    • VECUINT8 普通值、NULL 和多逻辑行均能正确物化,没有 panic。
    • 六种向量类型的 CREATE/DIFF/PICK/MERGE 全部成功。
    • PICK 和 MERGE 后向量内容及 NULL 语义与源表一致。
    • 普通及 -race 专项测试均连续 3 轮通过。

    结论:该问题在上述最新 main commit 上验证通过。

  7. Ariznawlll commented on Jul 30, 2026

    @Ariznawlll
    CollaboratorAuthor

    已在 main@0ebba1c0c96bbcf0ff4091236e10df7b97e24a0c 补充完成黑盒和白盒验证。

    黑盒验证:

    • MOTR 用例:issue_26136_data_branch_vectors.test
    • 覆盖六种 vector family,包含 VECUINT8 的 0/255 和 VECINT8 的 -128/127 边界。
    • 将 VECUINT8 放在 NULL 行之后和多个逻辑位置。
    • 覆盖 value→value、NULL→value、value→NULL、INSERT、DELETE。
    • 对 CREATE、DIFF、PICK、MERGE 后的 vector 文本和 NULL 状态做精确断言。

    结果:该 case 20/20 条 SQL/断言通过;本轮 Data Branch 全集 13/13 case、280/280 条 SQL/断言通过。

    白盒验证:

    go test ./pkg/frontend \
      -run '^(TestFormatValIntoString_DataBranchSpecialTypes|TestExtractDataBranchSQLRowValueUint8Array)$' \
      -count=1
    ok github.com/matrixorigin/matrixone/pkg/frontend
    

    Unhappy path / 类型边界:

    • VECUINT8 同时覆盖 0、255,VECINT8 覆盖 -128、127。
    • 在非首行位置覆盖 NULL→value、value→NULL,避免仅首行或非 NULL 数据通过。
    • 同一 diff 中混合 INSERT、UPDATE、DELETE,并在 PICK/MERGE 后检查每个 vector family 的精确文本。
    • 删除后的 vector 行必须消失,未选择和未修改的行必须保持不变,防止 materialization 错位。

    结论:VECUINT8 的行提取和 SQL literal materialization 与其他 vector 类型一致,NULL 和边界变化均验证通过;黑盒回归已加入 motr#69。

  8. Ariznawlll commented on Jul 30, 2026

    @Ariznawlll
    CollaboratorAuthor

    Unhappy Path / 类型边界专项验证

    测试版本:main@0ebba1c0c96bbcf0ff4091236e10df7b97e24a0c

    该问题的边界重点是 value shape、NULL 和数值极值:

    1. VECUINT8 覆盖 0、255。
    2. VECINT8 覆盖 -128、127。
    3. 在非首行位置覆盖 NULL→value、value→NULL。
    4. 同一 diff 混合 INSERT、UPDATE、DELETE。
    5. PICK/MERGE 后逐行检查所有 vector family 的精确文本及 NULL 状态。
    6. 删除行必须消失,未选择和未修改的行必须保持原值。

    结果:没有出现 VECUINT8 string/[]uint8 类型断言错误、NULL 错位或行 materialization 错位。专项用例 20/20 条 SQL/断言通过,相关 formatter/extractor Go 测试返回 ok。

    测试结论

    测试通过。

  9. added 3 commits that reference this issue on Sep 17, 2026
    3f2a144
    97bc584
    2e93502
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bugphase/testing

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions