Repository navigation
Fix temporal compatibility gaps for #24189 - #24214
Merged
16 commits merged intoApr 28, 2026
Merged
16 commits merged into
16 commits merged into
Conversation
Add parser, binder, function, and test coverage for CURTIME/CURRENT_TIME, ADDTIME, SUBTIME, TIMESTAMPADD, and GET_FORMAT on 3.0-dev. Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
The issue already has product support on 3.0-dev through the existing session-timezone parsing path, but it lacked a distributed SQL case that fixes the behavior at the user-visible LOAD DATA boundary. Constraint: Product code already handles session timezone for timestamp parsing Confidence: high Scope-risk: narrow Tested: go test ./pkg/sql/colexec/external -run 'Test_getColData_Timestamp' -count=1 Tested: mo-tester load_data_timestamp_timezone.sql, FAILED :0, ABNORAML :0, SUCCESS RATE : 100% Not-tested: Full distributed BVT suite
robll-v1
requested review from
XuPeng-SH,
aunjgr,
iamlinjunhong and
ouyuanning
as code owners
April 27, 2026 03:20
|
|
The PR conflicted with newer parser generation on 3.0-dev. Merge the updated base and regenerate mysql_sql.go from the already-merged mysql_sql.y grammar so the generated parser table matches both sides. Constraint: PR matrixorigin#24214 was marked DIRTY against 3.0-dev Confidence: high Scope-risk: narrow Tested: make -B mysql_sql.go in pkg/sql/parsers/dialect/mysql Tested: git diff --check Tested: go test ./pkg/sql/parsers/dialect/mysql -run 'Test.*(timestampadd|timestampdiff|curtime|get_format|GetFormat|TimestampAdd|TimestampDiff|Curtime)' -count=1 Tested: go test ./pkg/container/types -run 'Test(JudgeIntervalNumOverflowRejectsMinInt64|DatetimeAddInterval|Datetime_ToTime|DatetimeAddIntervalOverflowReturnsFalse|DatetimeAddDateTimeOverflowReturnsFalse)' -count=1 Tested: go test ./pkg/sql/plan/function -run 'TestBuiltInCurrentTimeUsesSessionTimezoneAcrossDayBoundary|Test(DateStringAddReturnTypeCompatibility|DateStringSubDateFormatOutput|.*(TimestampAdd|TimestampDiff|AddTime|SubTime|GetFormat|TimeDiff|DateStringAdd|DateStringSub))' -count=1 Not-tested: Full BVT suite after merge
The previous fix for matrixorigin#24189 updated temporal behaviors correctly, but several distributed result files still encoded mismatched output formatting for the CI mo-tester lane. This refreshes the affected date/datetime/timediff/date_add expectations to the exact runner-visible format used by the 3.0 BVT jobs. Constraint: CI job 73135408902 runs mo-tester with -n -g -o and compares runner-visible result formatting. Rejected: Keep hand-normalized mixed formats | they diverged from the CI runner and caused false BVT failures. Confidence: high Scope-risk: narrow Directive: Regenerate these temporal result files with the same mo-tester flags used in CI before changing formatting again. Tested: go test ./pkg/sql/plan/function -run 'Test_buildInM0ExplainPhy|TestCosineDistanceArray|TestTemporalFunctionReviewTypeCompatibility' -count=1 Tested: go test ./pkg/stream/adapter/kafka -run TestPopulateBatchFromMSGWithJSON -count=1 Tested: go test ./pkg/sql/compile -run TestCompile -count=1 Tested: mo-tester ./run.sh -n -g -o -p for dtype/date, dtype/datetime, dtype/datetime_precision_comprehensive, expression/temporal_interval, function/func_datetime_date_add, function/func_datetime_timediff Not-tested: full GitHub CI rerun completion
fengttt
approved these changes
Apr 27, 2026
ADDTIME and SUBTIME previously performed raw int64 arithmetic when combining temporal values with parsed TIME arguments. Boundary values could wrap or produce invalid datetime/timestamp values instead of the expected NULL. DATE_SUB also returned an unrecognized date out-of-range error from its underflow path, so the function layer could surface an error instead of marking the row NULL. Constraint: MySQL-compatible temporal overflow behavior requires invalid date/time arithmetic to return NULL for these function paths. Rejected: Leave DateSub on the generic error-check helper | it cannot translate dateOverflowMaxError into row NULLs. Confidence: high Scope-risk: moderate Directive: Keep temporal overflow paths on checked helpers; do not reintroduce direct int64 datetime arithmetic without range validation. Tested: go test ./pkg/sql/plan/function -run 'Test(BuiltInCurrentTimeUsesSessionTimezoneAcrossDayBoundary|DateStringAddReturnTypeCompatibility|DateStringSubDateFormatOutput|AddTimeSubTimeDatetimeTimestampOverflowReturnNull|DoDateSubOverflowUsesDateOverflowError|DateSubOverflowReturnsNull|.*(TimestampAdd|TimestampDiff|AddTime|SubTime|GetFormat|TimeDiff|DateStringAdd|DateStringSub))' -count=1 Tested: make build Tested: Manual SQL confirmed ADDTIME/SUBTIME/DATE_SUB boundary overflows return NULL Tested: mo-tester func_datetime_addtime.test, func_datetime_subtime.test, func_datetime_date_add.test all FAILED :0, ABNORAML :0, SUCCESS RATE : 100% Not-tested: Full repository BVT matrix after this final follow-up commit
The tenant task case executes the same manual task twice: first with a true gate and then with a false gate. Without waiting for each asynchronous run to be recorded, SHOW TASK RUNS can compare SUCCESS and SKIPPED rows before their order is stable in CI. Constraint: The BVT must still verify both SUCCESS and SKIPPED task-run records; it must not skip or ignore the status column. Rejected: Ignore the status column | that would hide the behavior under test. Confidence: medium Scope-risk: narrow Directive: Keep the waits adjacent to the manual task executions so SHOW TASK RUNS observes completed runs in command order. Tested: Manual mysql tenant-task repro confirmed latest two runs are SKIPPED then SUCCESS and tenant_sink count is 1. Not-tested: Full sql_task.sql under local mo-tester; local single-file parser rejected existing delimiter result text before reaching this case.
The PR branch diverged from 3.0-dev after upstream added parser/function changes for ELT, AES, and window aggregation. The merge keeps upstream parser and function enhancements, regenerates mysql_sql.go from the merged grammar, and preserves the temporal DATE_ADD/DATE_SUB/ADDTIME/SUBTIME compatibility fixes. Constraint: PR matrixorigin#24214 must be mergeable against current 3.0-dev without dropping upstream ELT/AES changes or temporal compatibility fixes. Rejected: Hand-edit generated mysql_sql.go conflict hunks | regeneration from merged mysql_sql.y is safer and reproducible. Confidence: high Scope-risk: moderate Directive: Keep ELT at function id 348 and assign temporal IDs after it unless a future base branch renumbers the function table. Tested: make -B mysql_sql.go in pkg/sql/parsers/dialect/mysql Tested: go test ./pkg/sql/parsers/dialect/mysql -run 'TestMysql' -count=1 Tested: go test ./pkg/sql/plan/function -run 'Test(Elt|TimeFormat|AddTimeSubTimeDatetimeTimestampOverflowReturnNull|DateSubOverflowReturnsNull|DoDateSubOverflowUsesDateOverflowError|TimestampDiffDateString)' -count=1 Tested: go test ./pkg/sql/plan/function -run 'Test_funids|TestFunctionIdMappings|Test.*FunctionId|Test.*FunctionID' -count=1 Tested: make build Not-tested: Full GitHub BVT matrix after merge resolution
The conflict-resolution commit moved additional ELT overflow tests into func_binary_elt_test.go but left the required math import only in the local worktree. Static-check therefore saw math.MaxUint64 without the import. Constraint: CI runs molint/go vet on committed files only; local unstaged imports do not count. Rejected: Remove overflow cases | they cover the upstream ELT behavior introduced by the base merge. Confidence: high Scope-risk: narrow Tested: go test ./pkg/sql/plan/function -run 'Test(Elt|TimeFormat)' -count=1 Not-tested: Full static-check locally
Multiple sql_task cases execute manual tasks and then immediately assert row counts or mo_task.sql_task_run status. CI can still observe RUNNING or stale task-run ordering because task execution and run persistence are asynchronous. Constraint: The BVT must keep validating SUCCESS, SKIPPED, FAILED, and TIMEOUT states instead of weakening status checks. Rejected: Revert the tenant-task wait only | the new failure shows the same timing assumption exists earlier in the file as well. Confidence: high Scope-risk: narrow Directive: When sql_task BVT asserts post-execute task state, keep an explicit wait before reading task_run metadata or derived row counts. Tested: Manual mysql repro for sql_task_cron/sql_task_manual/sql_task_gate with waits confirmed SUCCESS/SKIPPED ordering and expected row counts. Not-tested: Full sql_task.sql via local mo-tester; local delimiter/result parsing remains unreliable for this file outside CI.
The unbuffered channel could lose the signal when postEvict fired before the main goroutine reached <-evictStarted, causing a permanent hang. Buffer the channel to 1 and add a 2s select timeout as a safety net. Co-Authored-By: Claude Opus 4.6 <[email protected]>
XuPeng-SH
approved these changes
Apr 28, 2026
iamlinjunhong
approved these changes
Apr 28, 2026
ghost
approved these changes
Apr 28, 2026
ouyuanning
approved these changes
Apr 28, 2026
aunjgr
approved these changes
Apr 28, 2026
The latest 3.0-dev update added planner/parser work for null-safe equality and related DDL changes, conflicting with the PR branch's generated MySQL parser and function id table. The merge keeps the upstream null-safe equality function id, shifts the temporal function ids after it, and regenerates mysql_sql.go from the merged grammar. Constraint: PR matrixorigin#24214 must remain mergeable with current 3.0-dev while preserving matrixorigin#24189 temporal compatibility fixes. Rejected: Manually resolve generated mysql_sql.go hunks | regenerating from mysql_sql.y is safer and reproducible. Confidence: high Scope-risk: moderate Directive: Keep NULL_SAFE_EQUAL before temporal function IDs unless the base branch renumbers the full function table. Tested: make -B mysql_sql.go in pkg/sql/parsers/dialect/mysql Tested: go test ./pkg/sql/parsers/dialect/mysql -run 'TestMysql' -count=1 Tested: go test ./pkg/sql/plan/function -run 'Test_funids|TestFunctionIdMappings|Test.*FunctionId|Test.*FunctionID|TestNullSafeEqual|Test.*Compare' -count=1 Not-tested: Full GitHub BVT matrix after this merge
This pull request was closed.
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
Which issue(s) this PR fixes:
issue #24189
What this PR does / why we need it:
This PR backports the user-visible time/date compatibility work needed by 3.0-dev for #24189.
Main changes:
CURTIME/CURRENT_TIME,TIMEDIFF,TIMESTAMPADD,TIMESTAMPDIFF,GET_FORMAT,ADDTIME, andSUBTIME.DATE_ADD/DATE_SUBstring-input behavior and return typing with MySQL-compatible runtime behavior.NULLinstead of panicking or wrapping.time_zoneused during import.Validation performed:
go test ./pkg/container/types -run 'Test(JudgeIntervalNumOverflowRejectsMinInt64|DatetimeAddInterval|Datetime_ToTime|DatetimeAddIntervalOverflowReturnsFalse|DatetimeAddDateTimeOverflowReturnsFalse)' -count=1go test ./pkg/sql/plan/function -run 'TestBuiltInCurrentTimeUsesSessionTimezoneAcrossDayBoundary|Test(DateStringAddReturnTypeCompatibility|DateStringSubDateFormatOutput|.*(TimestampAdd|TimestampDiff|AddTime|SubTime|GetFormat|TimeDiff|DateStringAdd|DateStringSub))' -count=1go test ./pkg/sql/colexec/external -run 'Test_getColData_Timestamp' -count=1SDKROOT=$(xcrun --show-sdk-path) CPATH="$SDKROOT/usr/include/c++/v1" CPLUS_INCLUDE_PATH="$SDKROOT/usr/include/c++/v1" make buildcurtime,timediff,timestampadd,timestampdiff,get_format,addtime,subtime,date_add,date_sub, scale casts, large-overflowNULL, and LOAD DATA TIMESTAMP session timezone behavior.FAILED :0,ABNORAML :0,SUCCESS RATE : 100%:test/distributed/cases/function/func_datetime_curtime.testtest/distributed/cases/function/func_datetime_addtime.testtest/distributed/cases/function/func_datetime_subtime.testtest/distributed/cases/function/func_datetime_timestampadd.testtest/distributed/cases/function/func_datetime_date_add.testtest/distributed/cases/load_data/load_data_timestamp_timezone.sqlNote: this PR is scoped to the #24189 temporal compatibility surfaces. An unrelated fulltext BVT issue was observed locally and is not changed by this PR.