Skip to content

[Bug]: LOAD DATA LOCAL fills missing default-backed integer fields with NULL #30492

Closed as not planned

Description

@iamlinjunhong

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Branch Name

HEAD (detached at task workspace)

Commit ID

ff2acc1ace1a4b8a37dde011a9aa529ff2286c30

Other Environment Information

  • Hardware parameters: Apple Silicon, darwin/arm64
  • OS type: macOS 15.5 (24F74)
  • Others: standalone mo-service built from the above commit and launched with the test-offset frontend port 26201; MySQL 8.0.46 comparison instance on port 23506

Actual Behavior

In a default strict session, LOAD DATA LOCAL INFILE into a table with three columns from a CSV record that supplies only two fields writes NULL to the third column:

id  a  b
1   x  NULL
2   y  NULL

Expected Behavior

MySQL 8.0.46 loads the same file and table with 0 in b:

id  a  b
1   x  0
2   y  0

Steps to Reproduce

Create this local CSV file:

id,a
1,x
2,y

Then run, with the file visible to the MySQL client:

drop database if exists loom_repro;
create database loom_repro;
use loom_repro;
create table t(id int primary key, a varchar(10), b int default 77);
load data local infile '/tmp/repro_missing.csv' into table t
  fields terminated by ',' lines terminated by '\n' ignore 1 lines;
select * from t order by id;

Additional information

The MatrixOne run used mysql --local-infile=1 against the standalone service and produced NULL for both rows. The MySQL control used the same file, DDL, and LOAD statement and produced 0.

In materializeOneRow, when a LOCAL record has fewer fields than param.ColumnListLen, the existing field indexes end and the target vector receives a direct NULL append at pkg/sql/colexec/external/external.go:1871. That fallback bypasses the numeric zero-value adjustment used by the LOCAL MySQL conversion path. Related checks were made against the broader field-count and LOAD IGNORE issues listed below; none describes this default-backed LOCAL result mismatch.

Full reproduction, exactly as Loom ran it
printf '%s\n' 'id,a' '1,x' '2,y' > /tmp/repro_missing.csv
mysql --local-infile=1 -h 127.0.0.1 -P 26201 -u root -p111 -e "drop database if exists loom_repro; create database loom_repro; use loom_repro; create table t(id int primary key, a varchar(10), b int default 77); load data local infile '/tmp/repro_missing.csv' into table t fields terminated by ',' lines terminated by '\n' ignore 1 lines; select * from t order by id"

Found by Loom bug hunt (module: custom-a9872c7d6e; tests: unit, white-box, end-to-end)

Activity

  1. added
    kind/bug
    on Oct 17, 2026
  2. XuPeng-SH commented on Oct 22, 2026

    @XuPeng-SH
    Contributor

    This report is now tracked together with #30499. The canonical issue retains explicit acceptance cases for the behavior described here. This is an administrative duplicate/consolidation closure only; the underlying defect is not claimed fixed. The original description and discussion remain available on this issue.

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

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions