-
Notifications
You must be signed in to change notification settings - Fork 411
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
Support Extract DateTimeFromString #6300
Support Extract DateTimeFromString #6300
Conversation
Signed-off-by: birdstorm <[email protected]>
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Signed-off-by: birdstorm <[email protected]>
Signed-off-by: birdstorm <[email protected]>
Signed-off-by: birdstorm <[email protected]>
ac7785b
to
f9cadfa
Compare
Signed-off-by: birdstorm <[email protected]>
/run-all-tests |
/assign |
Signed-off-by: birdstorm <[email protected]>
{"121231113045", "2012-12-31 11:30:45"}, | ||
{"2012-02-29", "2012-02-29 00:00:00"}, | ||
{"00-00-00", "0000-00-00 00:00:00"}, | ||
// {"00-00-00 00:00:00.123", "2000-00-00 00:00:00.123"}, |
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.
Test cases use fixed fsp
; automatically calculating the fsp
of a String is not implemented yet. I think we can leave these cases for later.
{" \t\r2012^12^31T11+30+45 \n ", {31113045000000, 31113045, 311130, 3111}}, | ||
{"20121231113045", {31113045000000, 31113045, 311130, 3111}}, | ||
{"121231113045", {31113045000000, 31113045, 311130, 3111}}, | ||
// {"1701020304.1", {2030401000000, 2030401, 20304, 203}}, |
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.
Parsing for float string is not implemented yet. It is not going to be done in this PR.
/run-all-tests |
fmt::format("Illegal type {} of second argument of function {}. Must be DateOrDateTime.", arguments[1]->getName(), getName()), | ||
Errors::Coprocessor::BadRequest); | ||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT); | ||
|
||
return std::make_shared<DataTypeInt64>(); |
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.
Maybe we should return nullable type as some extraction may fail.
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.
consider doing it in another PR.
return signMultiplier(duration) * (duration.hours() * 10000LL + duration.minutes() * 100LL + duration.seconds()); | ||
} | ||
|
||
static Int64 extractDayMinute(Int64 nano) |
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.
How about overloading this function with static Int64 extractDayMinute(const MyDuration &)
so that we can directly pass MyDuration
value to the function and reduce usless construction and destruction.
Not only this but all functions similar to this function
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 think this is not necessary because functions named extractDayMinute
have different approaches. The DateTime
and the Duration
are not stored in the same format, they have different encoding formats and implementations. Moving these logics together may confuse readers.
result = ExtractMyDurationImpl::extractDayMinute(duration.nanoSecond()); | ||
|
||
Field datetime_field = parseMyDateTime(dtStr); | ||
if (!datetime_field.isNull()) |
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.
It seems that we prefer to return value which is parsed by parseMyDateTime
, how about moving codes related with paring duration to the tail of codes that parse datetime?
Not only in this function but also all similar functions
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.
We prefer to return value that is equivalently parsed by parseMyDuration
and parseMyDateTime
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.
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.
We prefer to return value that is equivalently parsed by
parseMyDuration
andparseMyDateTime
okk
/run-all-tests |
lgtm |
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.
Others LGTM
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.
Rest LGTM
/merge |
@birdstorm: It seems you want to merge this PR, I will help you trigger all the tests: /run-all-tests You only need to trigger If you have any questions about the PR merge process, please refer to pr process. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
This pull request has been accepted and is ready to merge. Commit hash: 367914f
|
What problem does this PR solve?
Issue number: close #6304
Support ExtractDateTimeFromString Sig.
Problem Summary:
What is changed and how it works?
Check List
Tests
Side effects
Documentation
Release note