-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mysql/datetime: Improve TIME parsing logic #15135
Conversation
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #15135 +/- ##
==========================================
+ Coverage 70.62% 70.65% +0.03%
==========================================
Files 1376 1376
Lines 182418 182454 +36
==========================================
+ Hits 128828 128919 +91
+ Misses 53590 53535 -55 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love this approach
1fb8522
to
0176ae7
Compare
In places inside the `evalengine` we need to know if a `TIME` instance was properly parsed, if a value could be extracted from input (but it wasn't entirely valid) or if there's enirely invalid input. Before we only had one flag that indicated the strict parsing. So we couldn't really discern partial parsing success from entire failure. We tried that with checking for a zero time, but that's wrong. A zero time is still an entirely valid time and can be the result of successful partial parsing. Signed-off-by: Dirkjan Bussink <[email protected]>
Signed-off-by: Dirkjan Bussink <[email protected]>
0176ae7
to
92f8b88
Compare
if i > math.MaxUint32 { | ||
return "", false | ||
} | ||
if i < -math.MaxUint32 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i < -math.MaxUint32
is no longer needed to check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@systay I realized it's a useless check, since when we get here we already consumed any -
at the beginning. So it can never be negative here, so hence the change to parse it as uint
and drop this bit.
This is in the v19.0.0 milestone, but was merged to 20.x. Will this be backported? |
@GrahamCampbell sure thing! |
Signed-off-by: Dirkjan Bussink <[email protected]>
In places inside the
evalengine
we need to know if aTIME
instance was properly parsed, if a value could be extracted from input (but it wasn't entirely valid) or if there's enirely invalid input.Before we only had one flag that indicated the strict parsing. So we couldn't really discern partial parsing success from entire failure. We tried that with checking for a zero time, but that's wrong. A zero time is still an entirely valid time and can be the result of successful partial parsing.
Related Issue(s)
This was identified in #15124, but the fix there didn't look like it was the right approach with yet another flag for allowing a zero time. This since we shouldn't really treat a zero time as special anyway.
Part of #15077
Checklist