-
Notifications
You must be signed in to change notification settings - Fork 847
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 day
and month
in temporal.rs
#1388
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1388 +/- ##
==========================================
+ Coverage 82.99% 83.05% +0.05%
==========================================
Files 181 181
Lines 52933 53076 +143
==========================================
+ Hits 43932 44082 +150
+ Misses 9001 8994 -7
Continue to review full report at Codecov.
|
let mut b = Int32Builder::new(array.len()); | ||
match array.data_type() { | ||
&DataType::Date32 | &DataType::Date64 | &DataType::Timestamp(_, _) => { | ||
extract_component_from_array!(array, b, month, value_as_datetime) |
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 the timezone
will impact hour, day, month, year
and other time unit which are higher than hour.
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.
For example:
2020-01-01 07:00:00 UTC0
The format at UTC-8 is 2019-12-31 23:00:00
and the year, month, day, hour
are all changed.
@Ted-Jiang
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.
Already add timezone support
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.
Looks good to me. Thank you @Ted-Jiang
Any other thoughts @liukun4515 ?
&DataType::Date32 | &DataType::Date64 | &DataType::Timestamp(_, None) => { | ||
extract_component_from_array!(array, b, month, value_as_datetime) | ||
} | ||
&DataType::Timestamp(_, Some(ref tz)) => { |
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.
👍
Some("-10:00".to_string()), | ||
)); | ||
let b = month(&a).unwrap(); | ||
assert_eq!(1, b.value(0)); |
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.
👍
Some("-10:00".to_string()), | ||
)); | ||
let b = day(&a).unwrap(); | ||
assert_eq!(1, b.value(0)); |
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.
LGTM
@alamb you can merge it.
It's nice for datafusion, if this pr can be merged before 10.0.0 release.
Thanks @Ted-Jiang @nevi-me and @liukun4515 ! |
day
and month
in temporal.rs
Which issue does this PR close?
Closes #1387 .