-
Notifications
You must be signed in to change notification settings - Fork 855
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
Feature add weekday temporal kernel #1891
Feature add weekday temporal kernel #1891
Conversation
d1a5f47
to
b510a7d
Compare
Codecov Report
@@ Coverage Diff @@
## master #1891 +/- ##
==========================================
- Coverage 83.48% 83.48% -0.01%
==========================================
Files 201 203 +2
Lines 56838 57156 +318
==========================================
+ Hits 47452 47715 +263
- Misses 9386 9441 +55
Continue to review full report at Codecov.
|
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.
Could we get a test or two of this functionality please
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 -- thank you for the contribution @nl5887 !
vec![Some(1514764800000), None, Some(1550636625000)].into(); | ||
|
||
let b = weekday(&a).unwrap(); | ||
assert_eq!(1, b.value(1)); |
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 like at least one test need to be updated: https://github.com/apache/arrow-rs/runs/6924858466?check_suite_focus=true |
Thanks, updated the test. Any opinions if we should use the ISO 8601 (similar to chrono-rs) week days (starting at Monday) or the US (starting at Sunday)? Currently it is using ISO (https://docs.rs/chrono/latest/src/chrono/lib.rs.html#646). |
I don't have any particular opinion -- it is likely that whatever we pick will be wrong for some usecases. The best long term is likely to allow the user to specify what behavior they want but I think we can do that in a follow on PR if anyone needs it |
@@ -211,6 +211,34 @@ where | |||
Ok(b.finish()) | |||
} | |||
|
|||
/// Extracts the day of week of a given temporal array as an array of integers |
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.
/// Extracts the day of week of a given temporal array as an array of integers | |
/// Extracts the day of week of a given temporal array as an array of integers | |
/// Monday is 0, Tuesday is 1, etc. |
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.
proposed in #1894
This feature will add the temporal kernel for weekday (day of week). When added, DOW support can be add to datafusion.