Skip to content

[Bug]: EXPORT_SET changes zero and negative bit counts to one #28211

Closed

Description

@Ariznawlll

Is there an existing issue for the same bug?

  • I have checked the existing issues.

The closed feature request #22993 predates the implementation and does not cover this boundary behavior.

Branch Name

main

Commit ID

e7bb0572235ec4bac81eb098eb0ad8900f0065ab

Other Environment Information

  • Local standalone MatrixOne; MySQL text protocol
  • Reference: MySQL 8.3.0

Actual Behavior

EXPORT_SET() forces number_of_bits values below 1 to 1:

SELECT HEX(EXPORT_SET(0, 'Y', 'N', '-', 0)),
       HEX(EXPORT_SET(1, 'Y', 'N', '-', 0));
-- MatrixOne: 4E, 59
-- MySQL:    '', ''

SELECT LENGTH(EXPORT_SET(0, 'Y', 'N', '-', -1));
-- MatrixOne: 1
-- MySQL:    127  (64 off-values plus 63 separators)

The results were reproduced three times.

Expected Behavior

Zero bits must produce the empty string. Negative values must follow MySQL's conversion/clipping behavior rather than being silently changed to one bit.

Steps to Reproduce

SELECT EXPORT_SET(0, 'Y', 'N', '-', 0);
SELECT EXPORT_SET(1, 'Y', 'N', '-', 0);
SELECT LENGTH(EXPORT_SET(0, 'Y', 'N', '-', -1));

Additional information

ExportSet currently executes if nBits < 1 { numberOfBits = 1 }, which directly causes both mismatches.

Activity

  1. added this to the MO-202609 milestone on Sep 5, 2026
  2. added
    kind/bug
    on Sep 5, 2026
  3. added theissue type on Sep 5, 2026
  4. self-assigned this
    on Sep 5, 2026
  5. added a commit that references this issue on Sep 11, 2026
    d191706
  6. Ariznawlll commented on Sep 12, 2026

    @Ariznawlll
    CollaboratorAuthor

    已在最新官方 main efb2c5084957ac90273a3f625668fc6a784562c4 验证。

    • 原始场景:EXPORT_SET 的 number_of_bits=0 与负数不再错误改写成 1。
    • Happy path:0 bits 返回空串;typed INT bit-count 列按每行值正确生成位集。
    • 边界控制:负数 count 按函数边界处理,65 的上界输入结果长度为 127,后续查询保持正常。
    • 自动化:已加入 MOTR PR (aoe)[daily-update]: correct the memory node size #165,issue_28210_28211_28392_28454_28456_28460_28461_functions;TestExportSetNumberOfBitsBoundaries 当前 main 定向通过,MOTR 三轮复跑 12/12 case、252/252 statements 一致通过。

    测试通过。

  7. added 3 commits that reference this issue on Sep 17, 2026
    e02e680
    ba172f7
    50d1b61
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bug

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions