expression: fix WEEK NULL mode handling#68440
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThe PR fixes the ChangesWEEK() NULL mode default
🎯 2 (Simple) | ⏱️ ~8 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #68440 +/- ##
================================================
- Coverage 77.2762% 75.7280% -1.5483%
================================================
Files 2010 2008 -2
Lines 555477 563839 +8362
================================================
- Hits 429252 426984 -2268
- Misses 125305 136720 +11415
+ Partials 920 135 -785
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
/retest-required |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: qw4990, windtalker The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
What problem does this PR solve?
Issue Number: close #59444
Problem Summary:
WEEK('2023-01-01', NULL)returnsNULLin TiDB, while MySQL returns the same result as mode0.What changed and how does it work?
This PR treats a
NULLsecond argument toWEEK(date, mode)as mode0, matching the existingYEARWEEK(date, mode)behavior and MySQL compatibility.The change is local to
WEEKexpression evaluation:builtinWeekWithModeSigbuiltinWeekWithModeSigCheck List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.
Summary by CodeRabbit
Bug Fixes
WEEK()function to properly handle NULL mode arguments by defaulting to mode 0 instead of returning NULL for the entire expression, achieving MySQL compatibility.