Skip to content

[Bug]: LOAD DATA non-strict invalid conversions abort instead of loading adjusted rows #25366

Closed

Description

@Ariznawlll

MatrixOne version

latest main tested locally: 0e8602b78

MySQL version

MySQL 8.0.45

Steps to Reproduce

Create a local CSV file:

1,12,12.345,20240102,abcd
2,abc,10.00x,2024-02-31,abcdef
3,,bad,0000-00-00,xy

Then run:

drop database if exists mysql_compat_model1_gap;
create database mysql_compat_model1_gap;
use mysql_compat_model1_gap;

set session sql_mode = '';
create table t_load(id int primary key, i int, d decimal(5,2), dt date, vc varchar(4));
load data local infile '/path/to/file.csv'
into table t_load
fields terminated by ',' lines terminated by '\n';

select id, i, d, dt, vc, hex(vc) from t_load order by id;

Expected Behavior

MySQL loads all rows and adjusts invalid / truncated values with warnings:

1  12  12.35  2024-01-02  abcd  61626364
2  0   10.00  0000-00-00  abcd  61626364
3  0   0.00   0000-00-00  xy    7879

Actual Behavior

MatrixOne aborts the load and no rows are inserted:

ERROR 20101: internal error: the input value 'abc' is not int32 type for column 1

Notes

I searched existing issues before filing. The close matches were parquet / JSONLine load issues or older loading null-handling items, not this MySQL CSV LOAD DATA LOCAL INFILE non-strict conversion behavior.

Activity

  1. added
    kind/bug
    severity/s1
    on Jul 2, 2026
  2. added this to the MO-202607 milestone on Jul 2, 2026
  3. added theissue type on Jul 2, 2026
  4. added and removed
    severity/s1
    on Jul 2, 2026
  5. LeftHandCold commented on Jul 3, 2026

    @LeftHandCold
    Collaborator

    Checked this while preparing the focused fix for #25352.

    I am not including #25366 in that PR because LOAD DATA invalid-value handling is a broad data-ingest semantic change, not a small compatibility bug fix. The reported cases overlap the same invalid numeric/date/decimal adjusted-value behavior discussed in #25364 and #25365.

    Changing this for LOAD DATA would need to define exactly which conversion failures become warnings, which rows are accepted, what adjusted values are written, how strict/non-strict modes interact with LOCAL and non-LOCAL load paths, and how warning counts/errors are reported. Those choices would affect shared load/insert assignment conversion paths and could change existing MO behavior for users relying on current rejection semantics.

    Because earlier discussion in #15345 indicates that some MySQL invalid-value behavior under IGNORE should not automatically be treated as MO-compatible behavior, this should wait for an explicit compatibility/product decision. After that decision, it should be implemented as a dedicated LOAD DATA compatibility PR with targeted BVT/UT coverage rather than bundled with the #25352 planner fix.

  6. Ariznawlll commented on Jul 3, 2026

    @Ariznawlll
    CollaboratorAuthor

    Reviewed the R&D comment and I agree this should not be fixed as a direct LOAD DATA bug without a product decision.

    The reported behavior belongs to the same invalid adjusted-value semantics as #25364/#25365: invalid numeric strings, invalid dates, decimal adjustment/saturation, warning counts, strict/non-strict mode, and row acceptance rules.

    For LOAD DATA specifically, changing this would require defining which conversion failures become warnings, what adjusted values are written, whether LOCAL/non-LOCAL paths differ, how partial rows and warning counts are reported, and how this interacts with shared insert/load assignment conversions. That is broader than a focused compatibility patch and may change current MO rejection semantics that users rely on.

    For future exploration, I will treat LOAD DATA invalid adjusted-value behavior as current MO behavior unless product direction explicitly says to match MySQL.

    Closing this issue as not planned/current behavior pending product decision.

  7. Ariznawlll commented on Jul 3, 2026

    @Ariznawlll
    CollaboratorAuthor

    Reopening: my previous close was premature.

    After re-reading the R&D comment, this is not confirmed as "not a bug". The comment means LOAD DATA invalid-value adjustment is a broad data-ingest semantic/product decision, not a small isolated fix.

    Under MySQL compatibility expectations, the behavior still differs from MySQL. Whether MO should accept rows with MySQL-style adjusted values/warnings in LOAD DATA needs explicit product/R&D confirmation, so this should remain open/needs-triage.

  8. added
    severity/s0
    and removed
    kind/bug
    on Jul 14, 2026
  9. LeftHandCold commented on Jul 14, 2026

    @LeftHandCold
    Collaborator

    fixed

  10. added
    ai-easy
    and removed on Jul 14, 2026
  11. Ariznawlll commented on Jul 16, 2026

    @Ariznawlll
    CollaboratorAuthor

    最新 main 验证结果

    结论:#25366 报告的问题已解决。在非严格模式下执行 LOAD DATA LOCAL INFILE,遇到非法字段转换时不再整批中止,数据可以正常写入。

    测试环境

    • MatrixOne 分支:最新 main
    • MatrixOne commit:8f3aee9cef5d667c6c7686d83cb155d0ba321e1f
    • 本地编译环境:darwin/arm64
    • Go:go1.26.4
    • 启动方式:./mo-service -launch etc/launch/launch.toml

    测试数据

    1,12,12.345,20240102,abcd
    2,abc,10.00x,2024-02-31,abcdef
    3,,bad,0000-00-00,xy
    

    测试 SQL

    drop database if exists mysql_compat_model1_gap;
    create database mysql_compat_model1_gap;
    use mysql_compat_model1_gap;
    
    set session sql_mode = '';
    
    create table t_load(
        id int primary key,
        i int,
        d decimal(5,2),
        dt date,
        vc varchar(4)
    );
    
    load data local infile '/tmp/issue25366.csv'
    into table t_load
    fields terminated by ','
    lines terminated by '\n';
    
    select id, i, d, dt, vc, hex(vc)
    from t_load
    order by id;

    实际结果

    LOAD 执行成功,没有再出现原来的错误:

    internal error: the input value 'abc' is not int32 type for column 1
    

    查询结果如下:

    +------+------+-------+------------+------+----------+
    | id   | i    | d     | dt         | vc   | hex(vc)  |
    +------+------+-------+------------+------+----------+
    |    1 |   12 | 12.35 | 2024-01-02 | abcd | 61626364 |
    |    2 |    0 | 10.00 | 0001-01-01 | abcd | 61626364 |
    |    3 |    0 |  0.00 | 0001-01-01 | xy   | 7879     |
    +------+------+-------+------------+------+----------+
    
    persisted_rows = 3
    

    重复验证

    连续执行 3 次 truncate + load + select:

    run=1, rows=3
    run=2, rows=3
    run=3, rows=3
    

    3/3 均成功,三行数据全部写入,结果一致。

    最终结论

    ✅ 最新 main 上已无法复现整批加载失败的问题,#25366 验证修复。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ai-easyseverity/s0

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions