Repository navigation
perf(sql): pipeline LOCAL CSV parsing with bounded workers - #33571
Merged
mergify[bot] merged 3 commits intoDec 2, 2026
Merged
Conversation
iamlinjunhong
requested review from
LeftHandCold,
XuPeng-SH,
aptend and
fengttt
as code owners
December 1, 2026 06:37
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
10 tasks
Contributor
|
Queue requested — the merge queue status continues in this comment ↓. |
iamlinjunhong
force-pushed
the
codex/load-local-production
branch
from
December 1, 2026 07:20
ae69702 to
09606cc
Compare
iamlinjunhong
force-pushed
the
codex/load-local-production
branch
from
December 2, 2026 09:14
0cd05e7 to
01007c7
Compare
Contributor
✅ Merged into
|
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
Which issue(s) this PR fixes:
Related to #31727. Latest investigation and validation summary.
What this PR does / why we need it:
LOAD DATA LOCAL currently parses and materializes its single upload stream serially. Add an opt-in bounded worker pipeline: a lightweight coordinator frames complete CSV records, workers parse and materialize chunks using the current columnLoader, and the consumer publishes batches in input order. The MySQL upload stream and statement transaction remain unchanged.
SET SESSION local_csv_workers = 16enables up to 16 workers, capped by session max_dop, GOMAXPROCS and existing query/CN scratch admission. The default is 0 (serial). Initial support is uncompressed LOCAL CSV with supported boundary grammar and at most 64 ordinary scalar columns; unsupported inputs stay serial. Large or uncertain records transfer the entire unpublished span to the authoritative serial parser. Scratch reservations, fixed ring credits, captured ingress cancellation, worker joining and handoff cleanup bound the new ownership paths. Reject a missing typed LOCAL ingress before wrapping it.The production implementation uses current main's columnLoader/vector APIs. The historical generic spool optimization is excluded. Design and ownership details are in
docs/design/20261201-load-local-csv-pipeline.md.Validation
Original implementation validation at
ae697026dae250498aeecfe3694314eecc06ded9.Performance
On host 36 (AMD 5900X, 24 logical CPUs), the same current binary imported the same fully resident 7,775,727,688-byte TPC-H lineitem input, 59,986,052 rows, into fresh instances:
Parallel LOCAL is 7.71x faster than serial and 6.7% slower than server LOAD in this controlled observation. Full-column/correlated-row fingerprints and five TPC-H aggregates agree. This is one observation per mode using the same binary, not a separate clean-base binary comparison or a rerun of the historical full workload campaign. Tiny host-wide swap events occurred; test cgroups had swap disabled. Checksums provide probabilistic equivalence.
A 10-second optimized CPU profile attributes 0.94% cumulative CPU to ScanRecordBoundary. Worker materialization and sink writing dominate sampled CPU; cumulative shares overlap and are not wall-time bottleneck fractions. Two-row import medians were 18.72/22.45 ms (serial/parallel); a 5 MiB/s upload was 1.972/1.974 s. Default-off avoids assigning startup overhead to all small imports. Wide/TEXT and compressed workloads are outside this optimization.
Integrated gpt-6-astra medium design/final review approved the tested candidate with no remaining material blockers. Remote services were restored and health checked. Hosted CI results are pending at publication.
Repair validation
Rebased on official
main@89cb66148d1c53ee2e4686b8cc8af52c7e7b7fca. The repair at09606ccc3c58f71e18f9d4e24992b09d933d46cccompletes six license headers and resolves two static-analysis findings by using reflection for the worker size assertions and matching the existing CSVParser receiver name.go vetandmake static-check-selectedpassed for csvparser, external, crt and frontend.mo-cgo-test -race -count=1package runs passed for csvparser, external and crt. The focused frontend race run passed 31 tests covering the session setting, EXPLAIN admission, LOCAL upload lifecycle and early rollback. External, crt and frontend results carry over from repair revisiond3032e221395000bc754832da42d8ca666a3e407because the intervening edits only adjusted csvparser receiver names and a test assertion implementation.SCA follow-up
09606ccc3c58f71e18f9d4e24992b09d933d46ccpassed the full license check, then stopped at the Makefile error-policy gate. The fix at01882df74b5570bbd95539533fdeeb1e4b461468uses MatrixOne error constructors for the LOCAL CSV framer and worker, and adds a regression for invalid chunk bounds. The test fails against the previous worker implementation and passes with the fix. Failed jobmake err-check,make static-check-analysiswith the repository's local PR selector, andgo vetpassed. The CGo race runs passed for csvparser and the focused LOCAL CSV external cases, including serial replay and upload-source error propagation.CI refresh on latest main
5b42e69ad5b608ca099aad87bdb8b7f78a58d73aat0cd05e7500c800722aa54752ef01d999f0158f16. The PR patch is byte-for-byte identical to the patch at033effc031926eb8844f2305daec19e8f17a07c6. The new base changes the UT runner's batch order and race test filters.bash -npassed for both changed runner scripts, andgo test -count=1 -run '^TestRaceInventory(Partition|CostLayoutScope|PreservesRunnableRootsAndStress)$' ./optoolspassed all three tests. The error-policy check, PR-file license headers and artifact check also passed.CI refresh after #33552
409d8c483f5d87436f689ce39e4c296b69e0f09bat01007c7893d1e23200b6429dc7dbffb2594ef823. The PR patch matches0cd05e7500c800722aa54752ef01d999f0158f16byte-for-byte. The new base changes shared plan/API definitions and table-dump behavior.go vetpassed for those packages.make err-check, PR-file license headers,git diff --check, and the artifact guard also passed. Earlier parser and benchmark evidence is reused.