Skip to content

Return empty RANGE frames for temporal PRECEDING underflow - #33212

Merged
mergify[bot] merged 4 commits into
matrixorigin:mainfrom
iamlinjunhong:codex/loom/develop/c29e67fa0175cb09fbc4a58e95b6088f30e402eb292954feae254bf6505fffe2
Nov 25, 2026
Merged

mergify[bot] merged 4 commits into
matrixorigin:mainfrom
iamlinjunhong:codex/loom/develop/c29e67fa0175cb09fbc4a58e95b6088f30e402eb292954feae254bf6505fffe2

Conversation

@iamlinjunhong

@iamlinjunhong iamlinjunhong commented Nov 25, 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:

An ascending temporal RANGE window can include the partition prefix when an INTERVAL ... PRECEDING start bound underflows. For DATE, DATETIME, and TIMESTAMP keys, the frame is now empty when the start arithmetic produces NULL and the end bound is valid. COUNT(*) returns 0, while SUM and AVG return NULL.

The window executor checks the temporal domain before classifying a failed subtraction as underflow. It still validates the end bound and propagates any error before returning the empty frame. The empty-frame marker also prevents a TIMESTAMP frame from being populated during daylight-saving fold evaluation.

  • Local tests passed for the window operator package and the full TestWindowTemporalIntervals SQL integration test. Incremental formatting, vet, and lint checks passed in both affected packages.
  • An independently built local MatrixOne server matched the empty-frame results from MySQL 8.0.46 for all three reported types. It also preserved the in-domain, descending, and FOLLOWING controls, the existing temporal window fixture results, and error 20203 for an invalid end bound.
  • Underflow classification uses constant-time arithmetic per affected row and adds no scans or frame buffers. No throughput benchmark was run.
  • Window arithmetic still omits the optional warning 1441. In a separate mixed-year DATE probe, MySQL 8.0.46 returned zero counts throughout a partition after the earliest row underflowed. MatrixOne evaluates underflow per row and preserves its existing results for subsequent in-range rows.

CI repair in 20fabd462e9f89e33988037611facc0988b4a279

  • The RANGE search helper moved an existing float32/float64 switch to a new function name. An explicit partial-family annotation records the supported types, and the obsolete baseline entry was removed. The UT gate failure also blocked coverage aggregation. Coverage UT job, coverage aggregation job
  • New local validation on Darwin/arm64 with Go 1.27.1 passed for pkg/container/types (including TestTypeSwitchFamilies) and pkg/sql/colexec/window using mo-cgo-test -short -tags matrixone_test -covermode=set -count=1. Formatting, incremental vet and lint, and the PR artifact check passed.
  • The prior Linux/x64 run passed the SQL integration package. That result applies to the unchanged window behavior and SQL tests. Linux/x64 UT Coverage and coverage aggregation subsequently passed on 20fabd462e9f89e33988037611facc0988b4a279. UT Coverage, coverage aggregation Prior coverage UT job

Race UT refresh in e31ff0d60a0016f15cf5b72c55b2fad2dbb3ce74

  • The previous Ubuntu/x86 race job reached the shared three-minute subtest deadline at the post-KILL prepared replay in TestIssue29492MultiCNCancellationCleanup/binary. The runner later reached its two-hour UT limit. The rebase includes the upstream split between the cancellation and replay budgets and the new pre-deadline replay diagnostics. All four PR patches are unchanged by range-diff. Race UT job, upstream test update
  • New Go 1.27.1 Darwin/arm64 validation passed on this rebased commit. mo-cgo-test -race -short -tags matrixone_test -count=1 passed the cancellation test in text and binary modes and the replay diagnostics test. The type and window packages passed with coverage, and TestWindowTemporalIntervals passed through SQL. Formatting, incremental vet and lint, and the artifact check passed.
  • The focused tests validated both protocols locally. The complete Ubuntu/x86 race run remains to be verified for this commit.

@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 commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Queue requested — the merge queue status continues in this comment ↓.

@iamlinjunhong
iamlinjunhong force-pushed the codex/loom/develop/c29e67fa0175cb09fbc4a58e95b6088f30e402eb292954feae254bf6505fffe2 branch from 20fabd4 to e31ff0d Compare November 25, 2026 07:37
@XuPeng-SH

XuPeng-SH commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: e31ff0d60a0016f15cf5b72c55b2fad2dbb3ce74

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: e31ff0d60a0016f15cf5b72c55b2fad2dbb3ce74

Assessment: approve

No actionable regression found. The fix reuses the existing temporal bound searches and propagates an empty-frame marker to aggregate and value-window consumers, including the TIMESTAMP fold path. The added year-zero classification runs only after temporal subtraction fails and preserves the existing end-bound validation and ordinary RANGE paths.

Model: gpt-6.1-terra / max

Session: 01a21136-dc54-7ba1-aace-4039c02570be · slot 2 · generation 3

Validation:

  • Reviewed the complete change, temporal arithmetic and interval normalization, sliding aggregate and value-window consumers, and the linked issue's controls. The current-head CI snapshot reports successful Ubuntu/x86 unit and coverage jobs and shared build.

  • The PR reports a same-head SQL integration pass and MySQL 8.0.46 comparisons for DATE, DATETIME and TIMESTAMP, with in-domain, DESC, FOLLOWING and invalid-end controls.

  • Private /tmp and loopback preflight and git diff --check passed; see preflight.log, diff-check.log and their checks/ receipts. All three discussion entries are accounted for in discussion-assessment.json.

Limitations:

  • No local Go tests were run: the native build was stopped after matching current-head CI evidence was confirmed. The reported external MySQL comparison was not independently reproduced, and its raw logs were not supplied.

  • The optional MySQL warning for arithmetic overflow remains unimplemented, as disclosed in the PR and permitted by the linked issue.

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

mergify Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

✅ Merged into main as 336486e at 10:10 UTC

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

So far

  • ✅ Entered the queue Wed 25 Nov, 09:14 · rule main · triggered by rule Automatic queue on approval for main
  • ✅ Checks skipped · PR is already up-to-date
  • ✅ Merged 10:10 · 336486e · squash
3 merge conditions met
  • #review-threads-unresolved = 0 · required by GitHub branch protection
  • github-review-approved · required by GitHub branch protection
  • any of · required by GitHub branch protection:
    • check-success = CI Required
    • check-neutral = CI Required
    • check-skipped = CI Required

Times in UTC · dashboard · how the merge queue works

This branch was previously deployed

1 inactive deployment
ci — e31ff0d6 Deployed Nov 25, 2026 by iamlinjunhong
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