Skip to content

[Compatibility]: FORMAT uses western grouping for en_IN, ta_IN, and te_IN locales #28478

Closed

Description

@Ariznawlll

Is there an existing issue for the same bug?

  • I have checked open and closed issues.

The old closed locale issue #10152 does not describe this current, locale-specific grouping defect. The current open FORMAT issues cover rounding and numeric-string conversion rather than locale grouping.

Branch Name

main

Commit ID

f0c31cd4b830be32442cf329e0a3fb08aa9c16c3

Other Environment Information

  • Local standalone MatrixOne built from the commit above
  • Reference: MySQL 8.3.0

Actual Behavior

FORMAT(..., locale) applies western three-digit grouping to en_IN, ta_IN, and te_IN:

SELECT FORMAT(123456789.12, 2, 'en_IN'),
       FORMAT(123456789.12, 2, 'ta_IN'),
       FORMAT(123456789.12, 2, 'te_IN');

MatrixOne:

123,456,789.12 | 123,456,789.12 | 123,456,789.12

MySQL 8.3:

12,34,56,789.12 | 12,34,56,789.12 | 12,34,56,789.12

The same difference occurs for negative numbers, locale names stored in a VARCHAR column, SQL PREPARE parameters, and CTAS materialization. Every form was executed three times.

Expected Behavior

For these three locales, FORMAT() should apply the locale's Indian grouping pattern: the lowest group has three digits and preceding groups have two digits.

Steps to Reproduce

SELECT FORMAT(123456789.12, 2, 'en_IN');
SELECT FORMAT(-123456789.12, 2, 'ta_IN');
SELECT FORMAT(123456789.12, 2, 'te_IN');

CREATE DATABASE codex_format_locale;
USE codex_format_locale;
CREATE TABLE src(id INT PRIMARY KEY, n DECIMAL(20,2), loc VARCHAR(10));
INSERT INTO src VALUES
  (1, 123456789.12, 'en_IN'),
  (2, 123456789.12, 'ta_IN'),
  (3, 123456789.12, 'te_IN');
SELECT id, loc, FORMAT(n, 2, loc) FROM src ORDER BY id;

PREPARE p FROM 'SELECT FORMAT(?, 2, ?)';
SET @n = 123456789.12, @loc = 'en_IN';
EXECUTE p USING @n, @loc;
DEALLOCATE PREPARE p;

CREATE TABLE dst AS SELECT id, loc, FORMAT(n, 2, loc) f FROM src;
SELECT * FROM dst ORDER BY id;

Controls

en_US, de_DE, gu_IN, and hi_IN match MySQL for the same value. The bg_BG reference output contains NUL separator bytes in this MySQL 8.3 build, so it is intentionally excluded from this issue rather than treating an ambiguous MySQL locale artifact as a MatrixOne defect.

Root Cause

pkg/vectorize/format/format.go maps en_IN, ta_IN, and te_IN directly to formatENUS, whose grouping routine always emits groups of three digits. There is no locale implementation for a final three-digit group preceded by repeated two-digit groups.

Activity

  1. added this to the MO-202609 milestone on Sep 9, 2026
  2. added theissue type on Sep 9, 2026
  3. Ariznawlll commented on Sep 9, 2026

    @Ariznawlll
    CollaboratorAuthor

    补充全量 locale 结果:从 pkg/vectorize/format/format.go 枚举出当前注册的全部 110 个 locale,使用 FORMAT(123456789.12, 2, locale) 和负数控制逐一与 MySQL 8.3 比较。

    • 明确的 MatrixOne 差异只有本 issue 中的 en_IN、ta_IN、te_IN,正负数均稳定复现;
    • 其余 106 个 locale 的结果字节一致;
    • bg_BG 是唯一额外差异:该 MySQL 8.3 build 返回 NUL (00) 作为分组分隔字节,而 MatrixOne 返回空格 (20)。这更像 MySQL locale 数据的异常/歧义,因此没有将它纳入本 issue 的修复范围。

    全量比较连续执行完成,证据包含每个 locale 的 HEX 结果,版本仍为 main@f0c31cd4b830be32442cf329e0a3fb08aa9c16c3。

  4. self-assigned this
    on Sep 9, 2026
  5. added a commit that references this issue on Sep 10, 2026
    1603316
  6. Ariznawlll commented on Sep 10, 2026

    @Ariznawlll
    CollaboratorAuthor

    测试版本

    • 分支:main
    • commit:fc621e3616d229c7a29d0c80e73ed8eb1997459c
    • 部署方式:本地单机 1 Log / 1 TN / 1 CN
    • 测试日期:2026-09-10

    原问题验证

    en_IN、负数 ta_IN、te_IN 的 FORMAT(123456789.12,2,locale) 连续 3 次返回 Indian 3-2-2 分组:12,34,56,789.12 / -12,34,56,789.12 / 12,34,56,789.12。

    Happy Path 覆盖

    1. locale 列、SQL PREPARE/EXECUTE 与 CTAS 物化路径均保持 Indian 分组。
    2. en_US 控制组保持西方三位分组 123,456,789.12。

    Unhappy Path 覆盖

    本 issue 的接受条件仅定义受支持 locale 的分组;未将未定义 locale fallback 当作本 issue 的错误路径。所有执行后 CTAS 与源表均可读取,未出现异常中断。

    白盒验证

    修复 PR matrixone#28508 已合入;pkg/vectorize/format 定向单测通过。

    回归测试

    已加入 MOTR PR #153:issue_28213_28475_28476_28478_28480_format_compatibility.test,连续 3 次通过。

    测试证据

    • 本地构建二进制的 Git commit 为 fc621e3616。
    • 回归提交:1cc567ea。

    测试结论

    测试通过。

  7. added 3 commits that reference this issue on Sep 17, 2026
    ef793b0
    79163fe
    7a03d78
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/compatibilitykind/bug

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions