Skip to content

fix: enforce TIME assignment bounds for external LOAD - #29969

Merged
XuPeng-SH merged 5 commits into
matrixorigin:mainfrom
iamlinjunhong:fix/29844-external-time-assignment
Oct 14, 2026
Merged

XuPeng-SH merged 5 commits into
matrixorigin:mainfrom
iamlinjunhong:fix/29844-external-time-assignment

Conversation

@iamlinjunhong

@iamlinjunhong iamlinjunhong commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

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

Related issue(s)

The issue stays open for the reporter to verify after merge.

What this PR does / why we need it:

External LOAD could persist TIME values beyond ±838:59:59.000000, and textual inputs beyond the internal duration range (for example 2562047788:00:00) failed early in the decoder even when native INSERT clipped them. CSV/JSONLINE now retain the original TIME text until shared assignment; Parquet STRING applies the same policy within each decoded page. Strict assignments reject with error 1690 and the original value; permissive/IGNORE assignments clamp to the signed endpoint with warning 1264.

Both LOAD planners validate supplied TIME before dependent defaults. Fractional conversion honors TIME_TRUNCATE_FRACTIONAL once. Typed Parquet TIME/timestamp sources retain their duration/timezone behavior, including extreme signed values and INT64_MIN diagnostics. LOCAL without REPLACE retains its scoped TIME assignment policy. The global statement IGNORE profile requires explicit IGNORE, preserving strict LOAD LOCAL rejection of invalid DATE/DATETIME/TIMESTAMP and integer inputs. Ordinary, prepared and internal profile tests verify reset and decoder behavior.

To keep the new text staging and assignment on the same implementation during rolling upgrades, supplied TIME inputs in CSV/JSONLINE/Parquet LOAD execute their readers and assignment on the coordinator CN. Local file, row-group and byte-offset parallelism still respects max_dop, and writer distribution uses its existing path. This conservatively includes typed Parquet TIME because schema is not yet known at routing; S3 reader throughput for these loads is limited to one CN. Arrow, foreign scans and omitted TIME default columns retain their existing placement. No new protocol fields, protocol version or storage migration are introduced.

Validation on macOS arm64 / Go 1.27.1 with verified CPU native artifacts:

  • Six complete owning packages passed through the repository CGo wrapper; final external and compile packages were revalidated after their last changes.
  • Incremental go vet and repository-pinned golangci-lint passed; gofmt and diff checks are clean.
  • Fourteen real native INSERT/LOAD/LOCAL probes verified signed endpoints, 1690/1264 diagnostics, strict rollback and LOCAL REPLACE behavior.
  • The TIME BVT (128 statements) and unchanged strict LOAD LOCAL regression issue_25366 (59 statements) passed 187/187 statements twice in normal comparison mode, with both databases dropped after each round and the owned service joined successfully. Before the scoped-policy correction, the exact PR head reproduced the same 10 issue_25366 failures seen in Compose PROXY CI; no expected results were relaxed.
  • Scope regressions verify coordinator placement, assignment attachment, complete file/row-group coverage, byte-offset/max_dop and unaffected route controls. Both real LOAD planners also verify assignment/global-policy separation through statement reuse and the existing LOCAL Parquet rejection.
  • gpt-6-astra medium design and final overall review passed without blocking findings.

Public SQL validation used a dedicated 1CN/1TN/1LOG instance. Mixed-version routing is supported by actual scope tests and execution-path review; a multi-CN mixed-version integration run and throughput benchmark were not performed locally. New CI results remain pending after delivery.

@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 kind/bug Something isn't working kind/test-ci labels Oct 12, 2026
@matrix-meow matrix-meow added the size/L Denotes a PR that changes [500,999] lines label Oct 12, 2026
@iamlinjunhong
iamlinjunhong force-pushed the fix/29844-external-time-assignment branch from 3c21381 to df1e257 Compare October 12, 2026 08:28
@XuPeng-SH

XuPeng-SH commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: f4e03b63683ea8a5ed14bf094da5d105a42b784e

Assessment: request_changes

Reviewed the complete 31-file delta and affected owners/callers. The previous overflow-text finding is addressed, but Parquet batch rollback can duplicate assignment warnings.

Model: gpt-6-astra / xhigh

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

  • P2 pkg/sql/colexec/external/parquet.go:2692: A permissive or IGNORE Parquet LOAD converts an overflowing STRING to TIME while its page slice crosses the output batch byte limit, such as in a wide-row load.
    Impact: Assignment publishes warning 1264 before batch admission. Rejected rows and remapped prefixes emit warnings again, inflating warning counts and duplicating SHOW WARNINGS entries. Diagnostics must be committed with accepted rows.
    Evidence: getDataByPage maps rows at line 5117, rolls back only vectors at 5127, and remaps the accepted prefix at 5131 or retries rejected rows in the next batch. mysqlTimeOutOfRangeForCast immediately appends to the process warning sink. A standalone probe using the frozen admission loop produced two rows with three warnings at a 10-byte budget; the 16-byte control produced two warnings. The probe uses stubbed vectors/pages/casts, not native execution. Evidence and an unexecuted production-reader regression recipe are saved in the attempt directory.

Validation:

  • Traced both LOAD planners, text staging, shared assignment casts, defaults, LOCAL policy, coordinator routing, Parquet cleanup and byte-budget rollback; reviewed tests, fixtures and documentation.

  • Reused exact-head successful shared-build, Ubuntu/x86 unit-test and coverage, Linux/arm64 SCA, PROXY BVT and COMPOSE/PESSIMISTIC BVT evidence.

  • Reviewed author-reported native probes and 187/187 public SQL statements passing twice; these cover the previous overflow-text concern and LOCAL regression.

  • Local gofmt and git diff --check passed; source remained clean. Frozen patch matches the assessed range apart from one terminal newline.

  • Standalone rollback probe completed successfully; results are recorded in validation.json and budget_warning_probe.log.

Limitations:

  • Native provenance verification rejected retained artifacts because the stamp is missing. No local native or SQL reproduction was claimed.

  • Mixed-version cluster execution and throughput benchmarks were not supplied. Coordinator-only TIME reader capacity is an explicitly documented tradeoff.

  • The frozen evidence references issue [Bug]: External file LOAD bypasses TIME assignment bounds enforced by native INSERT #29844 without its full body; its behavioral contract was assessed from the supplied PR description and comments.

@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: f4e03b63683ea8a5ed14bf094da5d105a42b784e

Assessment: request_changes

Reviewed the complete 31-file delta and affected owners/callers. The previous overflow-text finding is addressed, but Parquet batch rollback can duplicate assignment warnings.

Model: gpt-6-astra / xhigh

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

  • P2 pkg/sql/colexec/external/parquet.go:2692: A permissive or IGNORE Parquet LOAD converts an overflowing STRING to TIME while its page slice crosses the output batch byte limit, such as in a wide-row load.
    Impact: Assignment publishes warning 1264 before batch admission. Rejected rows and remapped prefixes emit warnings again, inflating warning counts and duplicating SHOW WARNINGS entries. Diagnostics must be committed with accepted rows.
    Evidence: getDataByPage maps rows at line 5117, rolls back only vectors at 5127, and remaps the accepted prefix at 5131 or retries rejected rows in the next batch. mysqlTimeOutOfRangeForCast immediately appends to the process warning sink. A standalone probe using the frozen admission loop produced two rows with three warnings at a 10-byte budget; the 16-byte control produced two warnings. The probe uses stubbed vectors/pages/casts, not native execution. Evidence and an unexecuted production-reader regression recipe are saved in the attempt directory.

Validation:

  • Traced both LOAD planners, text staging, shared assignment casts, defaults, LOCAL policy, coordinator routing, Parquet cleanup and byte-budget rollback; reviewed tests, fixtures and documentation.

  • Reused exact-head successful shared-build, Ubuntu/x86 unit-test and coverage, Linux/arm64 SCA, PROXY BVT and COMPOSE/PESSIMISTIC BVT evidence.

  • Reviewed author-reported native probes and 187/187 public SQL statements passing twice; these cover the previous overflow-text concern and LOCAL regression.

  • Local gofmt and git diff --check passed; source remained clean. Frozen patch matches the assessed range apart from one terminal newline.

  • Standalone rollback probe completed successfully; results are recorded in validation.json and budget_warning_probe.log.

Limitations:

  • Native provenance verification rejected retained artifacts because the stamp is missing. No local native or SQL reproduction was claimed.

  • Mixed-version cluster execution and throughput benchmarks were not supplied. Coordinator-only TIME reader capacity is an explicitly documented tradeoff.

  • The frozen evidence references issue #29844 without its full body; its behavioral contract was assessed from the supplied PR description and comments.

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

APPROVE for exact head 892f353c2c40d687dd1cfb05ff6c804779671b2d, base/merge-base 35c8dd5854750ef96f52f9dd298a70acd031d5e4.

Reviewed the complete 33-file change map, binary fixture contents, both LOAD planners, readers/assignment/default consumers, coordinator placement and warning-budget ownership. Read issue #29844 and all three historical reviews/conversation comments; there are no inline threads. Compared the f4e03b6 increment, including its rebased-main changes, against the complete current patch.

Both prior findings are closed:

  • Text outside int64 duration range is staged intact for CSV/JSONLINE, or passed through shared assignment inside bounded Parquet STRING mapping. 2562047788:00:00 and its negative now follow native strict 1690 versus permissive/IGNORE signed-clamp + 1264 policy, instead of decoder rejection.
  • Parquet candidate diagnostics are isolated in the existing bounded accumulator, discarded on zero/prefix rollback and flushed only after the accepted slice advances. Actual page and hybrid readers cover plain/dictionary input, byte-budget prefix remap/retry, exact count-only/retained warning capacity, error/cancellation/panic and failed hybrid rewind. The parent's sink remains unchanged; borrowed context/profile have no new cancellation owner; charged payload is released or transferred once.

Also checked typed INT64_MIN/Max sign preservation before FSP normalization, truthful MinInt64 diagnostics, one rounding/truncation decision, timestamp timezone behavior, NULLs and assignment before dependent defaults. LOCAL without REPLACE uses scoped assignment permissiveness; only explicit IGNORE enables global decoder/statement IGNORE, preserving strict unrelated temporal/integer failures and profile reuse/reset. The existing LOCAL Parquet rejection is tested through both planner entries.

Validation in an independent detached worktree:

  • Native make -j2 cgo passed; repository CGO wrapper used.
  • 56 selected normal roots passed across types, parser tree, function, external, planner and compile, including the actual placement/assignment attachment and file/row-group/offset/max_dop controls.
  • Four warning-admission roots measured race T=0.01/0.02/0/0 seconds; N=100 each under the floor(30/T), max100 rule. All 400 repetitions passed, without race reports.
  • A temporary native-reader probe decoded all four committed Parquet fixtures and independently checked raw signed duration endpoints/extremes, NULLs, STRING overflow clamping/fractional value and warning counts. All four controls passed; probe/worktree will be removed.
  • Existing author-reported public INSERT/LOAD/LOCAL probes and 187/187 normal SQL comparisons repeated twice are reused as historical, source-scoped evidence for the unchanged assignment/LOCAL paths, not relabeled as my fresh exact-head frontend or mixed-version execution. Latest warning rollback closure is independently verified by the current native readers above.
  • Source diff/whitespace checks pass.

Important integration limitation: the overall local seven-package invocation did not fully pass. Frontend could not compile because main's JSON EXPLAIN references removed VectorIndexScan APIs. Both sql_json.go blob 10dc7f9010540215625eb6df55e3d5c141672301 and generated plan blob 9be5c1a9e47f4a0bac4c5e7761d8fc8764d21ce2 are identical to the exact base and unchanged by this PR. The current Connector/J job reports the same four compiler errors. MatrixOne ALL run38369323214/attempt2 is queued. This approval does not waive that baseline integration repair/current CI or claim a fresh public SQL service pass.

Q1/Q2/Q3 ownership/cleanup, cancellation and bounded diagnostic staging were checked. This is a corrective shared-assignment fix, with no new wire/catalog representation or generic framework. Coordinator-only supplied-TIME readers conservatively preserve mixed-version decoding/assignment placement; one-CN S3 reader capacity is an explicitly acknowledged tradeoff, not measured throughput neutrality. No mixed-version cluster or throughput run is claimed. No remaining confirmed PR-introduced blocker found.

Stage bounded assignment diagnostics for scalar and hybrid readers until their page slices pass byte-budget admission. Discard warnings on rollback, prefix remapping and failed hybrid rewind without changing the execution attempt sink. Native reader regressions cover exact counts, retention and error cleanup.
@XuPeng-SH

XuPeng-SH commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: 3dfdd30783a06a5b26e339ea38f0ef5161d8a2d4

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: 3dfdd30783a06a5b26e339ea38f0ef5161d8a2d4

Assessment: approve

Reviewed the complete 33-file delta and affected callers. The design restores TIME assignment consistency through existing casts, preserves scoped LOCAL policy, and publishes Parquet warnings only after row admission. Both prior findings are addressed; no actionable defect remains.

Model: gpt-6-astra / xhigh

Session: 01a12d8f-8e48-7622-ad17-b605f08450ce · slot 1 · generation 0

Validation:

  • Reviewed both LOAD planners, conversion and default ordering, fractional handling, signed extremes, statement reuse, coordinator placement, warning rollback and cleanup. Tests cover strict/permissive/IGNORE behavior, cancellation, panic and byte-budget remapping.

  • Frozen current-head evidence records successful Ubuntu/x86 UT, Linux/arm64 SCA, UT coverage, Compose PROXY BVT, multi-CN PESSIMISTIC BVT and CI Required. Skipped checks were not counted as passes.

  • Local static audit passed: clean assigned HEAD, patch reconciliation, all 33 HEAD blobs, diff whitespace, changed Go formatting, text-fixture parity and Parquet framing/dictionary payload checks. Matched receipt checks/1791955124399515855-2.json to source-evidence-audit-v2.log and source-evidence-audit.json in the assigned attempt directory.

  • The initial audit incorrectly assumed binary-patch encoding. Its failed receipt and log remain retained; the corrected audit verified the supplied representation. This was not a product failure.

Limitations:

  • No Go or SQL tests were rerun locally. local_validation is empty; raw CI and author execution logs were unavailable. Author counts and review prose naming an older head were not treated as independently verified current-head runs.

  • Coordinator pinning deliberately limits supplied-TIME LOAD readers to one CN while preserving local parallelism and existing writer placement. Text staging adds conversion and copying costs. No throughput benchmark or live mixed-version run was supplied; scope tests and caller review support this documented compatibility tradeoff.

  • The linked issue body was absent from frozen evidence; its contract was assessed through the PR description, discussions and regression cases. Binary fixture inspection was static, not a full native Parquet decode.

@mergify

mergify Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-14 05:20 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🚫 Left the queue — 2026-10-14 05:53 UTC · at 3dfdd30783a06a5b26e339ea38f0ef5161d8a2d4

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

Reason

The pull request can't be updated

GitHub response: refusing to allow a GitHub App to create or update workflow .github/workflows/iceberg-connector.yml without workflows permission
GitHub only lets Mergify write to .github/workflows/ with the workflows permission. An organization owner can accept Mergify's pending permissions at https://dashboard.mergify.com/orgs/matrixorigin/repositories.

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 — 62da339d Deployed Oct 14, 2026 by XuPeng-SH
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 kind/test-ci size/XXL Denotes a PR that changes 2000+ lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants