parse: fix the type of date/time parameters (#48237) #58283
+1,551
−6
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.
This is an automated cherry-pick of #48237
What problem does this PR solve?
Issue Number: close #45190
Problem Summary:
What is changed and how it works?
Refractor the
stmtctx
inparse
to betypes.Context
.Construct the date and time from string.
I didn't construct the
Datetime
andDuration
directly from the binary, because developing a binary version ofParseXXX
can be a little complicated (especially for handling warnings/errors). To be simple and compatible with old versions, I re-use the string from old version and parse from it.Refractor the function of parsing parameters into two parts: one for splitting binary protocols into multiple parameters, one for parsing the binary parameters into expressions. The second one needs to run after when the
stmtctx
is reset, so they need to be split. It also solves some historical problem, as I also sawHandleTruncate
s besides thedate/time
part.Check List
Tests
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.