Skip to content

fix(external): support Decimal256 CSV and JSONLINE loads - #28612

Merged
mergify[bot] merged 2 commits into
matrixorigin:mainfrom
VioletQwQ-0:codex/issue-28590-decimal256
Sep 14, 2026
Merged

mergify[bot] merged 2 commits into
matrixorigin:mainfrom
VioletQwQ-0:codex/issue-28590-decimal256

Conversation

@VioletQwQ-0

@VioletQwQ-0 VioletQwQ-0 commented Sep 10, 2026 •

Copy link
Copy Markdown
Collaborator

What type of PR is this?

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

Which issue(s) this PR fixes:

issue #28590

What this PR does / why we need it:

CSV and JSONLINE external paths reached the unsupported conversion branch for DECIMAL256 columns. This change parses Decimal256 values with the target precision and scale, appends the fixed Decimal256 value, validates Decimal256 rows for parallel offset calculation, and keeps numeric zero-fill and adjusted-value handling consistent with Decimal64 and Decimal128.

Production file:

  • pkg/sql/colexec/external/external.go

Regression coverage:

  • pkg/sql/colexec/external/decimal256_test.go
  • test/distributed/cases/load_data/decimal256_external_load.sql
  • test/distributed/cases/load_data/decimal256_external_load.result
  • test/distributed/resources/load_data/decimal256_external.csv
  • test/distributed/resources/load_data/decimal256_external.jl
  • Unit coverage exercises precision 39/40/50/76, signed values, scale rounding, NULL and empty fields, invalid and overflow values, CSV, JSONLINE object/array, parallel varchar intermediate handling, and zero-fill predicates.
  • BVT exercises CSV and JSONLINE external SELECT, INSERT SELECT, and LOAD DATA INLINE terminals with high-precision values, NULLs, invalid input, and overflow rollback.

Scope and non-goals:

  • externalwrite/encode.go and Parquet paths are unchanged because they already support Decimal256.
  • The public Decimal256 parser is unchanged, including its existing negative-boundary behavior.
  • makeType and isDirectParallelLoadType remain unchanged so Decimal256 continues through the varchar intermediate path for parallel loading.

Validation:

  • Unit/focused: PASS — Decimal256 focused tests using the controlled CGo test wrapper.
  • External package: PASS — full pkg/sql/colexec/external package tests.
  • Controlled CGo build/vet: PASS.
  • Independent challenge: PASS — fixed limb oracle for precision 39/40/50/76, signed boundaries, rounding carry, invalid/overflow rollback sequences, JSON json.Number object/array inputs, NULL, and parallel boundary behavior.
  • Race/repetition: PASS — focused challenge and regression tests with -race -count=3.
  • BVT content: PASS — production SQL cases and CSV/JSONLINE resources are included in this PR; runtime execution remains pending.
  • git diff --check: PASS.
  • Base behavior: FAIL as reported by issue [Bug]: CSV and JSONLINE external paths cannot read or load DECIMAL256 columns #28590 — CSV DECIMAL256 loading reaches the unsupported conversion path; deployed SQL replay is pending.
  • PR-head behavior: PASS at package-level materialization/reader coverage; real SQL SELECT, INSERT SELECT, and LOAD DATA terminal verification remain pending.

Exact evidence:

  • head: cc67f2a92fd19a380fb7ea108ae36958f90caaf3
  • target base (matrixorigin/matrixone:main): 269d59addd032d20897cc4d86f58de3e387a6d76
  • merge-base: 269d59addd032d20897cc4d86f58de3e387a6d76
  • full diff hash (binary patch from merge-base to head): b87dc5c94210eb0448acb9383651d7716dc0250a1edc6b9fd9f1d437a88dade7

QA Decision

  • required: yes
  • reason: this changes user-visible CSV/JSONLINE external SQL behavior, and deployed SQL/BVT coverage is still pending.
  • production_entrypoint: CSV/JSONLINE external field materialization used by external table SELECT/INSERT SELECT and LOAD DATA.
  • automated_terminal_coverage: package-level reader/materialization tests, independent Decimal256 challenge, and the authored production SQL BVT case.
  • remaining_validation: exact-head CI, BVT runtime, real SQL SELECT, INSERT SELECT, LOAD DATA, and QA environment verification.

@mergify mergify Bot added the kind/bug Something isn't working label Sep 10, 2026
@matrix-meow matrix-meow added the size/M Denotes a PR that changes [100,499] lines label Sep 10, 2026
@VioletQwQ-0
VioletQwQ-0 marked this pull request as ready for review September 10, 2026 08:24
@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 →

@VioletQwQ-0

Copy link
Copy Markdown
Collaborator Author

Current head cc67f2a92fd19a380fb7ea108ae36958f90caaf3, run 34454978374: this is a CI environment/setup failure, not a product-test result. The Ubuntu/x86 UT job fails before starting because the workflow call is missing the required EE_DB_ADDR, EE_DB_PORT, EE_DB_USER, EE_DB_PASSWORD, and EE_DB_DB secrets; CI Required then reports the aggregate failure. No code-test conclusion is available and no rerun was forced.

@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.

GPT-6 medium deep review of exact head 0d316a114d87de3108151ea5a04988dd0b075362: no blockers found.

Reviewed Decimal256 CSV/JSONLINE parsing, precision/scale conversion, NULL and error cleanup paths, and the changed SQL/UT coverage. The added tests use small deterministic fixtures. Exact-head CI run 34833344163 passed; decimal256_external_load.sql passed 25/25 in 0.391s. The UT artifact does not expose individual timings for the added tests, and no evidence showed a test near the 45-second limit or material race-UT slowdown.

@mergify mergify Bot added the queued label Sep 14, 2026
@mergify

mergify Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-09-14 12:08 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ✅ Checks skipped · PR is already up-to-date
  • ✅ Merged — 2026-09-14 12:09 UTC · at 60248a08953f7d55b80c4980284c3fd89cfd9aef · squash

This pull request spent 37 seconds in the queue, including 2 seconds running CI.

Required conditions to merge

@mergify
mergify Bot merged commit 60248a0 into matrixorigin:main Sep 14, 2026
28 of 29 checks passed
@mergify mergify Bot removed the queued label Sep 14, 2026
VioletQwQ-0 added a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…n#28612)

CSV and JSONLINE external paths reached the unsupported conversion branch for DECIMAL256 columns. This change parses Decimal256 values with the target precision and scale, appends the fixed Decimal256 value, validates Decimal256 rows for parallel offset calculation, and keeps numeric zero-fill and adjusted-value handling consistent with Decimal64 and Decimal128.

Production file:
- `pkg/sql/colexec/external/external.go`

Regression coverage:
- `pkg/sql/colexec/external/decimal256_test.go`
- `test/distributed/cases/load_data/decimal256_external_load.sql`
- `test/distributed/cases/load_data/decimal256_external_load.result`
- `test/distributed/resources/load_data/decimal256_external.csv`
- `test/distributed/resources/load_data/decimal256_external.jl`
- Unit coverage exercises precision 39/40/50/76, signed values, scale rounding, NULL and empty fields, invalid and overflow values, CSV, JSONLINE object/array, parallel varchar intermediate handling, and zero-fill predicates.
- BVT exercises CSV and JSONLINE external SELECT, INSERT SELECT, and LOAD DATA INLINE terminals with high-precision values, NULLs, invalid input, and overflow rollback.

Scope and non-goals:
- `externalwrite/encode.go` and Parquet paths are unchanged because they already support Decimal256.
- The public Decimal256 parser is unchanged, including its existing negative-boundary behavior.
- `makeType` and `isDirectParallelLoadType` remain unchanged so Decimal256 continues through the varchar intermediate path for parallel loading.

Validation:
- Unit/focused: PASS — Decimal256 focused tests using the controlled CGo test wrapper.
- External package: PASS — full `pkg/sql/colexec/external` package tests.
- Controlled CGo build/vet: PASS.
- Independent challenge: PASS — fixed limb oracle for precision 39/40/50/76, signed boundaries, rounding carry, invalid/overflow rollback sequences, JSON `json.Number` object/array inputs, NULL, and parallel boundary behavior.
- Race/repetition: PASS — focused challenge and regression tests with `-race -count=3`.
- BVT content: PASS — production SQL cases and CSV/JSONLINE resources are included in this PR; runtime execution remains pending.
- `git diff --check`: PASS.
- Base behavior: FAIL as reported by issue matrixorigin#28590 — CSV DECIMAL256 loading reaches the unsupported conversion path; deployed SQL replay is pending.
- PR-head behavior: PASS at package-level materialization/reader coverage; real SQL `SELECT`, `INSERT SELECT`, and `LOAD DATA` terminal verification remain pending.

Exact evidence:
- head: `cc67f2a92fd19a380fb7ea108ae36958f90caaf3`
- target base (`matrixorigin/matrixone:main`): `269d59addd032d20897cc4d86f58de3e387a6d76`
- merge-base: `269d59addd032d20897cc4d86f58de3e387a6d76`
- full diff hash (binary patch from merge-base to head): `b87dc5c94210eb0448acb9383651d7716dc0250a1edc6b9fd9f1d437a88dade7`

QA Decision
- required: yes
- reason: this changes user-visible CSV/JSONLINE external SQL behavior, and deployed SQL/BVT coverage is still pending.
- production_entrypoint: CSV/JSONLINE external field materialization used by external table SELECT/INSERT SELECT and LOAD DATA.
- automated_terminal_coverage: package-level reader/materialization tests, independent Decimal256 challenge, and the authored production SQL BVT case.
- remaining_validation: exact-head CI, BVT runtime, real SQL `SELECT`, `INSERT SELECT`, `LOAD DATA`, and QA environment verification.

Approved by: @XuPeng-SH
VioletQwQ-0 added a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…n#28612)

CSV and JSONLINE external paths reached the unsupported conversion branch for DECIMAL256 columns. This change parses Decimal256 values with the target precision and scale, appends the fixed Decimal256 value, validates Decimal256 rows for parallel offset calculation, and keeps numeric zero-fill and adjusted-value handling consistent with Decimal64 and Decimal128.

Production file:
- `pkg/sql/colexec/external/external.go`

Regression coverage:
- `pkg/sql/colexec/external/decimal256_test.go`
- `test/distributed/cases/load_data/decimal256_external_load.sql`
- `test/distributed/cases/load_data/decimal256_external_load.result`
- `test/distributed/resources/load_data/decimal256_external.csv`
- `test/distributed/resources/load_data/decimal256_external.jl`
- Unit coverage exercises precision 39/40/50/76, signed values, scale rounding, NULL and empty fields, invalid and overflow values, CSV, JSONLINE object/array, parallel varchar intermediate handling, and zero-fill predicates.
- BVT exercises CSV and JSONLINE external SELECT, INSERT SELECT, and LOAD DATA INLINE terminals with high-precision values, NULLs, invalid input, and overflow rollback.

Scope and non-goals:
- `externalwrite/encode.go` and Parquet paths are unchanged because they already support Decimal256.
- The public Decimal256 parser is unchanged, including its existing negative-boundary behavior.
- `makeType` and `isDirectParallelLoadType` remain unchanged so Decimal256 continues through the varchar intermediate path for parallel loading.

Validation:
- Unit/focused: PASS — Decimal256 focused tests using the controlled CGo test wrapper.
- External package: PASS — full `pkg/sql/colexec/external` package tests.
- Controlled CGo build/vet: PASS.
- Independent challenge: PASS — fixed limb oracle for precision 39/40/50/76, signed boundaries, rounding carry, invalid/overflow rollback sequences, JSON `json.Number` object/array inputs, NULL, and parallel boundary behavior.
- Race/repetition: PASS — focused challenge and regression tests with `-race -count=3`.
- BVT content: PASS — production SQL cases and CSV/JSONLINE resources are included in this PR; runtime execution remains pending.
- `git diff --check`: PASS.
- Base behavior: FAIL as reported by issue matrixorigin#28590 — CSV DECIMAL256 loading reaches the unsupported conversion path; deployed SQL replay is pending.
- PR-head behavior: PASS at package-level materialization/reader coverage; real SQL `SELECT`, `INSERT SELECT`, and `LOAD DATA` terminal verification remain pending.

Exact evidence:
- head: `cc67f2a92fd19a380fb7ea108ae36958f90caaf3`
- target base (`matrixorigin/matrixone:main`): `269d59addd032d20897cc4d86f58de3e387a6d76`
- merge-base: `269d59addd032d20897cc4d86f58de3e387a6d76`
- full diff hash (binary patch from merge-base to head): `b87dc5c94210eb0448acb9383651d7716dc0250a1edc6b9fd9f1d437a88dade7`

QA Decision
- required: yes
- reason: this changes user-visible CSV/JSONLINE external SQL behavior, and deployed SQL/BVT coverage is still pending.
- production_entrypoint: CSV/JSONLINE external field materialization used by external table SELECT/INSERT SELECT and LOAD DATA.
- automated_terminal_coverage: package-level reader/materialization tests, independent Decimal256 challenge, and the authored production SQL BVT case.
- remaining_validation: exact-head CI, BVT runtime, real SQL `SELECT`, `INSERT SELECT`, `LOAD DATA`, and QA environment verification.

Approved by: @XuPeng-SH
VioletQwQ-0 added a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…n#28612)

CSV and JSONLINE external paths reached the unsupported conversion branch for DECIMAL256 columns. This change parses Decimal256 values with the target precision and scale, appends the fixed Decimal256 value, validates Decimal256 rows for parallel offset calculation, and keeps numeric zero-fill and adjusted-value handling consistent with Decimal64 and Decimal128.

Production file:
- `pkg/sql/colexec/external/external.go`

Regression coverage:
- `pkg/sql/colexec/external/decimal256_test.go`
- `test/distributed/cases/load_data/decimal256_external_load.sql`
- `test/distributed/cases/load_data/decimal256_external_load.result`
- `test/distributed/resources/load_data/decimal256_external.csv`
- `test/distributed/resources/load_data/decimal256_external.jl`
- Unit coverage exercises precision 39/40/50/76, signed values, scale rounding, NULL and empty fields, invalid and overflow values, CSV, JSONLINE object/array, parallel varchar intermediate handling, and zero-fill predicates.
- BVT exercises CSV and JSONLINE external SELECT, INSERT SELECT, and LOAD DATA INLINE terminals with high-precision values, NULLs, invalid input, and overflow rollback.

Scope and non-goals:
- `externalwrite/encode.go` and Parquet paths are unchanged because they already support Decimal256.
- The public Decimal256 parser is unchanged, including its existing negative-boundary behavior.
- `makeType` and `isDirectParallelLoadType` remain unchanged so Decimal256 continues through the varchar intermediate path for parallel loading.

Validation:
- Unit/focused: PASS — Decimal256 focused tests using the controlled CGo test wrapper.
- External package: PASS — full `pkg/sql/colexec/external` package tests.
- Controlled CGo build/vet: PASS.
- Independent challenge: PASS — fixed limb oracle for precision 39/40/50/76, signed boundaries, rounding carry, invalid/overflow rollback sequences, JSON `json.Number` object/array inputs, NULL, and parallel boundary behavior.
- Race/repetition: PASS — focused challenge and regression tests with `-race -count=3`.
- BVT content: PASS — production SQL cases and CSV/JSONLINE resources are included in this PR; runtime execution remains pending.
- `git diff --check`: PASS.
- Base behavior: FAIL as reported by issue matrixorigin#28590 — CSV DECIMAL256 loading reaches the unsupported conversion path; deployed SQL replay is pending.
- PR-head behavior: PASS at package-level materialization/reader coverage; real SQL `SELECT`, `INSERT SELECT`, and `LOAD DATA` terminal verification remain pending.

Exact evidence:
- head: `cc67f2a92fd19a380fb7ea108ae36958f90caaf3`
- target base (`matrixorigin/matrixone:main`): `269d59addd032d20897cc4d86f58de3e387a6d76`
- merge-base: `269d59addd032d20897cc4d86f58de3e387a6d76`
- full diff hash (binary patch from merge-base to head): `b87dc5c94210eb0448acb9383651d7716dc0250a1edc6b9fd9f1d437a88dade7`

QA Decision
- required: yes
- reason: this changes user-visible CSV/JSONLINE external SQL behavior, and deployed SQL/BVT coverage is still pending.
- production_entrypoint: CSV/JSONLINE external field materialization used by external table SELECT/INSERT SELECT and LOAD DATA.
- automated_terminal_coverage: package-level reader/materialization tests, independent Decimal256 challenge, and the authored production SQL BVT case.
- remaining_validation: exact-head CI, BVT runtime, real SQL `SELECT`, `INSERT SELECT`, `LOAD DATA`, and QA environment verification.

Approved by: @XuPeng-SH
@VioletQwQ-0
VioletQwQ-0 deleted the codex/issue-28590-decimal256 branch December 1, 2026 03:47

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

kind/bug Something isn't working 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