Skip to content

[4.2-dev] fix external JSONLINE nulls in parallel load - #33210

Merged
XuPeng-SH merged 5 commits into
matrixorigin:4.2-devfrom
VioletQwQ-0:codex/4.2-dev-jsonline-null
Nov 25, 2026
Merged

XuPeng-SH merged 5 commits into
matrixorigin:4.2-devfrom
VioletQwQ-0:codex/4.2-dev-jsonline-null

Conversation

@VioletQwQ-0

@VioletQwQ-0 VioletQwQ-0 commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

What type of PR is this?

  • BUG
  • Test and CI

Which issue(s) this PR fixes:

Related to #29768. Cherry-picks #29773 onto 4.2-dev.

What this PR does / why we need it:

Parallel JSONLINE LOAD DATA must preserve explicit JSON nulls as SQL NULL for numeric and Boolean columns. Respect the field null marker before applying the existing empty CSV numeric zero-fill rule.

Base bb197e5118507d830f5e50f99a2676bb88a8d62f, current head 051489b1608be825421f9b7bc15b5721b6fcb311. The producer-to-consumer test failed with the old production file and passed with the cherry-pick. The external package passed on the initial release base, and focused external UT passed on the current release production content. git diff --check passed.

BVT: test/distributed/cases/load_data/issue_29768_jsonline_null.sql passed 20/20 against standalone binary 028e094f1a57e6ffb8913651f5bc85bfed5310b7, with no failed or ignored statements. The first attempt exposed unsupported DECIMAL256 in the 4.2 JSONLINE loader. The current SQL and result fixtures use DECIMAL(38,10) and assert the exact imported values for serial and parallel object/array input. Those two fixtures are the only changes since the running binary and were used for the passing run.

QA required: yes. Re-run with the affected import configuration and verify previously imported data separately.

## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [ ] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

issue matrixorigin#29768

The issue remains open for QA; this PR does not auto-close it.

## What this PR does / why we need it:

Parallel `LOAD DATA` JSONLINE currently converts an explicit JSON `null`
into numeric and boolean zero values because the empty-field zero-fill
branch ignores the field's null marker. Preserve `Field.IsNull` so
nullable INT, DECIMAL, and BOOL columns keep SQL `NULL` for both
JSONLINE object and array input.

## Root cause and scope

`transJsonObject2Lines` and `transJsonArray2Lines` already emit
`csvparser.Field{IsNull: true}` for JSON `null`. The shared parallel
LOAD DATA consumer now applies the empty numeric zero-fill rule only
when `Field.IsNull` is false. Ordinary empty CSV numeric fields continue
to use the existing zero-fill behavior, and CSV `\\N` remains `NULL`.

## Validation

- Exact base `b6fa8ccfc729105a31f61dbed0c97d7f21a2b86e` build: PASS.
- Focused external UTs for empty numeric, JSONLINE object/array
producer-to-consumer nulls, typed zero, and `\\N`: PASS.
- Full owning package `./pkg/sql/colexec/external` via the repository
CGo wrapper: PASS.
- Incremental `go list`, `go vet`, and `golangci-lint --new-from-rev
b6fa8cc` with repository CGo flags:
PASS.
- Canonical SQL/BVT
`test/distributed/cases/load_data/issue_29768_jsonline_null.sql`: PASS
20/20 twice (serial and explicit parallel object/array JSONLINE; INT,
DECIMAL(39,10), BOOL; non-null and explicit-null rows; teardown).

The reviewed PR base is `c2c1031d0ba4b1034849f6bd3d267252a11eb6c9`; its
one-commit delta from the tested base does not touch the affected
package or LOAD DATA JSONLINE fixtures. No implementation dependency or
merge-order prerequisite is required.

## QA decision

QA required: yes. Automated tests cover object/array JSONLINE null
materialization and stored INT, DECIMAL, and BOOL values, with two
normal BVT comparison runs and teardown. The small SQL fixtures exercise
the requested-parallel policy and may fall back below parallel
admission; they do not establish physically admitted multi-worker SQL
execution. That deployment scenario remains QA work. Ready indicates
maintainer review; CI, deployed QA, and merge remain pending. No QA
handoff is sent by this update.

## Partial scope

This change covers nullable scalar INT, DECIMAL, and BOOL values
supplied as explicit JSON `null` through JSONLINE object and array
records in parallel LOAD DATA. It leaves unrelated formats, non-null
empty-field compatibility behavior, and issue closure to their existing
paths.

## Final head binding

Reviewed exact PR head: `3a1a64c56abd641a07a418af148fc95380139873`, a
Mergify merge of `main` `c2c1031d0ba4b1034849f6bd3d267252a11eb6c9` into
implementation commit `b57b3896348448324dfa1329b84145445c2700b0`; the
merge has no changes under the affected external LOAD DATA or issue
29768 fixture paths.

- Exact-head focused command selected and passed all four named controls
with `-v -count=1`: `TestGetColDataParallelLoadEmptyNumericAndJSONNull`,
`TestJSONLineNullRemainsNullWithParallelLoad` (object/array),
`TestGetColDataParallelLoadEmptyNumericAsTypedZero`, and
`TestGetColDataParallelLoadNullNumericRemainsNull`.
- Exact-head owning-package command `mo-cgo-test -count=1 -timeout=120s
./pkg/sql/colexec/external`: PASS.
- Independent Astra A/B semantic preflight is complete with
`PASS_NO_BLOCKING_FINDING`; its report is bound to the same head/base.
CI, deployed QA, merge, and issue closure remain external follow-up.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit 5171a0c)
@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 →

@XuPeng-SH

XuPeng-SH commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: 6581d0e5b9403d50de15cd8346ad27cd11a860c3

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: 6581d0e5b9403d50de15cd8346ad27cd11a860c3

Assessment: approve

The shared external conversion owner now preserves explicit JSON null markers before applying the existing empty-numeric-to-zero policy and propagates null-append allocation errors. The existing owner handles the distinction without new state or a parallel conversion path. The committed small-file SQL cases exercise the requested parallel setting; an additional branch-specific large-file probe confirmed actual two-range execution and correct stored values.

Model: gpt-6.1-terra / max

Session: 01a211d7-e427-70e2-a993-c62f1960cb9e · slot 3 · generation 3

Validation:

  • Private /tmp and loopback preflight passed on the assessed head: preflight.log and checks/1795601513698833523-3.json.

  • The complete external owning package passed on the assessed head with 1,078 named tests/subtests and no skips: owning-package-tests.log and checks/1795602126476643931-5.json. The separate focused run covered JSON object/array nulls, empty and missing numeric fields, and allocation failures: focused-tests.log and checks/1795601725350204034-3.json.

  • A reviewer-only Go overlay exercised the MySQL TCP frontend of a one-CN embedded cluster with serial and STRICT false parallel LOAD for object and array JSONLINE files of approximately 289 MB each. Each load checked every INT, DECIMAL(38,10), BOOL and null marker for 24,000 rows (3,428 null rows, zero mismatches); server logs record mcpu=2 and two distinct file ranges in each parallel load. The test passed: review_json_null_integration_test.go, review-overlay.json, integration-tests.log and checks/1795602016855442153-5.json.

  • Native build inputs and retained library checksums matched the assessed source before reuse: native-reuse.log and checks/1795601525844056895-3.json.

Limitations:

  • The committed two-row SQL fixtures fall below the 128 MiB parallel-read threshold, so their parallel-requested cases use the small-file fallback; real two-range execution was verified by the reviewer-only probe.

  • The large-file probe used one CN and direct local files; it did not repeat the linked issue’s multi-file or multi-CN scenarios. The linked issue’s reported multi-file validation was on main, not this 4.2 branch.

@mergify mergify Bot added the queued label Nov 25, 2026
@mergify

mergify Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

🚫 Left the queue · pull request dequeued

1 h 9 min in the queue, with no time running CI.

So far

  • ✅ Entered the queue Wed 25 Nov, 10:24 · rule release-4.2 · triggered by rule Automatic queue on approval for release-4.2
  • ⏹️ Testing stopped · in place
  • 🚫 Left the queue 11:33 · 1bb2400

Reason

Pull request #33210 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.

To get back in the queue

  • Push a change if one is needed: the pull request is queued again once its queue conditions match.
  • If no change is needed, tick the box below to queue it again as it is.

Merge conditions not met when it left the queue

  • any of · required by GitHub branch protection:
    • check-neutral = CI Required
    • check-skipped = CI Required
    • check-success = CI Required

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

  • Requeue this pull request
2 merge conditions met
  • #review-threads-unresolved = 0 · required by GitHub branch protection
  • github-review-approved · required by GitHub branch protection

Times in UTC · dashboard · how the merge queue works

@VioletQwQ-0

Copy link
Copy Markdown
Collaborator Author

@Ariznawlll 请协助验收包含合并提交 21f38a48f7b7a0e3c89f9194f71f5691e5148b75 的 4.2-dev 构建。#29768 已记录主分支的验收结果,本次只需核对 4.2。

  1. 请按受影响的导入配置,分别用对象和数组两种 JSONLINE 文件执行并行 LOAD DATA,确认实际读到了多个分片。按输入行标识核对 INT、DECIMAL(38,10)、BOOL 三列:显式 JSON null 导入后应满足 IS NULL,非空对照值(含 0 和 false)应与源文件一致。
  2. 请单独抽查修复前已导入的记录,按行与原始文件比对,记录核对范围及差异。若无历史样本或原文件,请注明该项未验证。

请在本 PR 回填实际构建提交、环境、两种格式的预期和实际 NULL 行数、差异及历史数据核对结果。

@VioletQwQ-0
VioletQwQ-0 deleted the codex/4.2-dev-jsonline-null branch December 1, 2026 03:47

This branch was successfully deployed

No deployments
ci — 1bb24001 Deployed Nov 25, 2026 by mergify[bot]
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 kind/test-ci size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants