Skip to content

fix(load): preserve safe parallel splits for long CSV records - #31515

Merged
XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
iamlinjunhong:codex/loom/develop/86e7d05d310fe55a40e031b12bde910758fab5408771a081b443bc8c3bd61818
Oct 28, 2026
Merged

XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
iamlinjunhong:codex/loom/develop/86e7d05d310fe55a40e031b12bde910758fab5408771a081b443bc8c3bd61818

Conversation

@iamlinjunhong

@iamlinjunhong iamlinjunhong commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

What this PR does / why we need it:

Follow-up to merged #31387, which bounded bad-CSV planning probes, suppressed speculative conversion reports and added cancellation. Its 256 KiB cap can also merge a valid long-record file into one effective reader.

Keep 256 KiB as a soft stopping threshold and derive a checked hard budget from the execution parser's record-size limit and CSV tokens. An initial fragment and the next candidate can complete. Suffix probing and optional verification share that byte allowance and at most 256 parser calls.

When physical probing reaches the former cap, verify each proposed boundary exactly from FileStartOff, including subsequent boundaries. Reject unsafe multiline and BOM restart boundaries, retaining earlier ranges and merging the tail. Each acquired stream closes before another opens, with cancellation and close-error precedence preserved.

Validation at 3db81d9d8d19dbf7a93208ca4959fb6f93661f55 (Go 1.27.1, darwin/arm64):

  • Reproduced the equality regression before the repair: a 6143-byte BOM field becomes 6140 bytes, and valid multiline CSV errors with 20301. Verification now also starts when physical suffix input equals 256 KiB.
  • Rerun at 192158edb79f3b8e6c1364303b4d2b7ab83b1490 after the first rebase; reused after the final Python-only main update (Go, native and test inputs unchanged): the complete external package and ten strict-load SQL scenarios with -vet=all, including seven threshold unit variants and three public equality scenarios. Exact serial/parallel values, retained fanout and safe fallback are asserted.
  • Configured incremental golangci-lint reports zero issues. Reused pinned molint analysis (built with Go 1.27) exits 0 with an existing unsafe-import diagnostic in untouched reader_arrow_test.go; that file and the diagnostic's inputs match the frozen base. Independent design/final review is reused for the identical complete PR patch; the delivery artifact checks pass.
  • Earlier Linux/x64 CI is green and is reused for unchanged paths. New-head Linux CI is pending. No new race or throughput campaign was run for this sequential threshold correction.

The authoritative CSVConfigForLoad mapping and main's parallel-worker isolation remain integrated. The prior short-probe allocation diagnostic was about 88 KiB, confirming the hard cap is not preallocated. The earlier unrelated UT cleanup timeout is tracked in #31545.

CI refresh: the two PR commits were replayed onto official main 8f9bcd29ed8c236ec55c13bb9b88267a3a2a79ea. All five PR files and the complete PR patch remain identical. Run 40672111550 failed when the single planner race process reached its cumulative 40-minute package timeout; the active case had just started, and no race report or compilation failure was logged. Main now includes #31593's bounded planner scheduling change. This authorized rebase triggers new CI with that change; it does not establish that the timeout is fixed. The superseded run is not rerun.

Verification may reread a prefix. Its shared hard cap is about 384 MiB per attempt with the default record limit; distant targets or prefixes with many short records can still reduce fanout. No throughput improvement percentage is claimed. The issue remains open for reporter verification after merge.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@mergify mergify Bot added the kind/bug Something isn't working label Oct 28, 2026
@matrix-meow matrix-meow added the size/L Denotes a PR that changes [500,999] lines label Oct 28, 2026
@iamlinjunhong
iamlinjunhong force-pushed the codex/loom/develop/86e7d05d310fe55a40e031b12bde910758fab5408771a081b443bc8c3bd61818 branch from ab3575c to 7f1ac84 Compare October 28, 2026 06:26
@XuPeng-SH

XuPeng-SH commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-local · done

Commit: 7f1ac84220670931b69abecafbd4ab3529ad0a1d

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mo-bot review · mo-bot-local · review

Commit: 7f1ac84220670931b69abecafbd4ab3529ad0a1d

Assessment: request_changes

Complete delta and discussion reviewed. One confirmed regression bypasses boundary verification at exactly 256 KiB, causing silent field-byte loss or rejecting valid multiline CSV. The frozen base passes identical probes.

Model: gpt-6-astra / xhigh

Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1

  • P1 pkg/sql/colexec/external/external.go:803: A strict suffix probe reads exactly 262144 bytes before real EOF and returns a candidate before file end. The expanded reader can accept this candidate where the old capped reader failed, but the strict greater-than comparison leaves verification disabled.
    Impact: Parallel LOAD can silently strip an internal field's UTF-8 BOM or split inside a quoted record. Include equality in the verification trigger and add exact-threshold multiline/BOM regressions.
    Evidence: Public SQL probes show parallel LOAD succeeding while shortening a field from 6143 to 6140 bytes; serial LOAD and the frozen base preserve every byte. A multiline variant instead returns Error 20301 on the candidate. Adding two bytes triggers verification and both variants pass. Logs and matching receipts are indexed in /home/xupeng/.local/state/mo-bot/jobs/020698b25455fa452a22ca3d/attempt-1/validation-manifest.json.

Validation:

  • Selected maintained strict-probe tests and all seven existing LOAD scenarios passed; additional review probes caused the candidate commands to fail.

  • Identical public SQL probes passed at the clean frozen merge-base; adjacent size controls passed on both revisions.

  • Isolation preflight, native provenance, formatting, source integrity and receipt/log reconciliation passed. Discussion ledger saved.

Limitations:

  • SQL probes use the existing file-specific fanout admission hook with small fixtures; parser, planner and execution paths are real.

  • No additional full-suite, race or throughput campaign was performed after confirming the regression. Frozen green CI does not cover these counterexamples.

@XuPeng-SH

XuPeng-SH commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-local · done

Commit: 3db81d9d8d19dbf7a93208ca4959fb6f93661f55

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mo-bot review · mo-bot-local · review

Commit: 3db81d9d8d19dbf7a93208ca4959fb6f93661f55

Assessment: approve

The prior exact-256-KiB verification bypass is resolved, with BOM and multiline regressions covered. Boundary verification, shared budgets, cancellation, and fallback preserve the reviewed contracts. No actionable findings remain.

Model: gpt-6-astra / xhigh

Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1

Validation:

  • Reviewed all five changed files, parser and compiler consumers, linked issues, and every discussion item.

  • Reused frozen successful build, UT, SCA, coverage, and applicable BVT results; author reports external-package and ten strict-load SQL scenarios passing.

  • Source integrity, patch equality, whitespace, and five-key discussion audit passed. Receipt checks/1793205311704325968-4.json matches review-audit.console.log.

Limitations:

  • No local Go tests or benchmarks were run; detailed execution logs were not supplied.

  • The earlier validation commit was unavailable locally, so its claimed rebase equivalence was not independently verified. Current-head CI provides fresh evidence.

  • Prefix verification may consume approximately 384 MiB per attempt and reduce fanout when its budget is exhausted; throughput gains remain unmeasured.

@mergify mergify Bot added the queued label Oct 28, 2026
@mergify

mergify Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

🚫 Left the queue

20 min in the queue, with no time running CI.

So far

  • ✅ Entered the queue Wed 28 Oct, 16:36 · rule main · triggered by rule Automatic queue on approval for main
  • ⏹️ Testing stopped · in place
  • 🚫 Left the queue 16:56 · 03addfc

Reason

Pull request #31515 has been dequeued

Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.

The author needs to enable "Allow edits from maintainers" on this pull request.

Hint

You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it.
If you do update this pull request, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

Merge conditions: 2 of 3 met

This pull request

Condition Required by
✅ #review-threads-unresolved = 0 GitHub branch protection
✅ github-review-approved GitHub branch protection

The batch, tested in place

Condition Required by
❌ any of: check-neutral = CI Required, check-skipped = CI Required, check-success = CI Required GitHub branch protection

Tick the box to put this pull request back in the merge queue (same as @mergifyio queue).

  • Requeue this pull request

Times in UTC · dashboard · how the merge queue works

This branch was previously deployed

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

Labels

dequeued kind/bug Something isn't working size/XL Denotes a PR that changes [1000, 1999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants