Skip to content

fix(sql): enforce zero-width parquet text columns - #29988

Merged
XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
iamlinjunhong:fix/parquet-zero-width-29811
Oct 12, 2026
Merged

XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
iamlinjunhong:fix/parquet-zero-width-29811

Conversation

@iamlinjunhong

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:

After #29831, Parquet still accepted nonempty values into CHAR(0) and VARCHAR(0) because the shared target-width check required width > 0. LOAD DATA could persist those values, and external tables could expose them to INSERT ... SELECT with already-narrow type metadata.

This follow-up includes zero in the CHAR/VARCHAR width check at the common Parquet append boundary. Empty strings and NULL remain valid; nonempty strings are rejected before append in plain, dictionary, converted scalar, row, and nested text paths. Existing page/chunk rollback handles the error. Positive widths, BINARY padding, and negative internal width metadata retain their behavior. Four old test scenarios now specify widths that fit their unchanged nonempty values.

This completes the zero-width boundary missed by #29831; the returned report does not establish a newly introduced regression. The issue should be verified by the reporter after merge.

Validation on current main base 02a2823c2007d5e4fb4ada148e93743df337551a, Go 1.27.1, macOS/arm64:

  • New regression cases fail against the unchanged reader and pass with the correction; the full pkg/sql/colexec/external package passes via mo-cgo-test -count=1 -timeout=10m.
  • Independent PyArrow plain/dictionary files: 74 SQL checks cover CHAR/VARCHAR(0), empty/NULL, ASCII/accent/emoji, both LOAD parallel options, external SELECT, INSERT SELECT, and rollback when a later row group is invalid. Existing seed rows survive failed loads.
  • stage/export_format.sql passes normal mo-tester comparison twice on the same isolated instance: 173/173 statements each; table/stage/file teardown checked.
  • Incremental go vet, configured golangci-lint (0 issues), gofmt, and git diff --check pass. The local lint tool uses Go 1.27 and compatible analysis dependencies.

No additional allocations or positive-width work are introduced. Runtime validation used one CN with separate LogService/TN configuration; the reporter's Linux/amd64 dual-CN evidence is historical. CI is pending.

@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 Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: 2cce7256fb1e220be899b3f68bf04302ddf9a6ce

Assessment: approve

Reviewed the complete five-file delta. The shared Parquet append boundary correctly enforces CHAR/VARCHAR(0), preserving empty strings, NULL, existing rollback and other width/type behavior. No actionable defects found.

Model: gpt-6-astra / xhigh

Session: 01a12d8f-7dea-77c2-a565-38d45b5564e4 · slot 0 · generation 0

Validation:

  • Traced plain, dictionary, converted scalar, row and nested-text consumers through the shared validator and existing error cleanup.

  • Reviewed regression coverage for zero width, Unicode, invalid UTF-8, empty versus NULL, rollback, LOAD DATA, external SELECT and INSERT SELECT. Existing nonempty-value tests retain their assertions with appropriate positive widths.

  • Verified all changed files and relevant reader/vector dependencies are unchanged from the authored revision. Reused reported full external-package tests, 74 independent PyArrow SQL checks and two successful BVT comparison runs.

  • Frozen exact-head CI records successful build, Ubuntu UT, coverage, arm64 SCA, proxy BVT and pessimistic multi-CN BVT.

  • Source remains clean and git diff --check passes. Review evidence is recorded in attempt-1/review-audit.json.

Limitations:

@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: 2cce7256fb1e220be899b3f68bf04302ddf9a6ce

Assessment: approve

Reviewed the complete five-file delta. The shared Parquet append boundary correctly enforces CHAR/VARCHAR(0), preserving empty strings, NULL, existing rollback and other width/type behavior. No actionable defects found.

Model: gpt-6-astra / xhigh

Session: 01a12d8f-7dea-77c2-a565-38d45b5564e4 · slot 0 · generation 0

Validation:

  • Traced plain, dictionary, converted scalar, row and nested-text consumers through the shared validator and existing error cleanup.

  • Reviewed regression coverage for zero width, Unicode, invalid UTF-8, empty versus NULL, rollback, LOAD DATA, external SELECT and INSERT SELECT. Existing nonempty-value tests retain their assertions with appropriate positive widths.

  • Verified all changed files and relevant reader/vector dependencies are unchanged from the authored revision. Reused reported full external-package tests, 74 independent PyArrow SQL checks and two successful BVT comparison runs.

  • Frozen exact-head CI records successful build, Ubuntu UT, coverage, arm64 SCA, proxy BVT and pessimistic multi-CN BVT.

  • Source remains clean and git diff --check passes. Review evidence is recorded in attempt-1/review-audit.json.

Limitations:

  • No native tests were rerun locally; frozen CI statuses and author execution reports were reused. Raw execution logs were not supplied.

  • Full issue #29811 text was unavailable; approval covers the documented zero-width follow-up. The reporter's historical dual-CN reproduction was not rerun locally.

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

mergify Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-12 10:19 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue — 2026-10-12 10:25 UTC · at e1e845c80461ca53e59b2dc79f1ba1e151577c38

This pull request spent 5 minutes 47 seconds in the queue, with no time running CI.

Reason

The pull request can't be updated

This pull request seems to come 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, or update the branch manually.

Hint

You should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

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

  • Requeue this pull request

This branch was previously deployed

1 inactive deployment
ci — e1e845c8 Deployed Oct 12, 2026 by mergify[bot]
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