-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 on intervals and durations #12514
Conversation
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.
Thanks @nrc -- this is looking really close to me.
I think we should reasses the null handling (I left a suggestion) as well as some additional testing but otherwise this is ready to go 🚀
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2d4732d
to
3f91868
Compare
Null handling and tests addressed. It took a tiny bit more code to make @alamb ready for re-review, thanks! |
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 great -- thank you @nrc and @samuelcolvin and @alexmojaki
})?; | ||
Ok(Arc::new(r)) | ||
} else { | ||
// Nulls in secs are preserved, nulls in subsecs are treated as zero to account for the case |
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.
👍
Which issue does this PR close?
Closes #6327.
Closes #7097
What changes are included in this PR?
Support
extract
/date_part
by passing through requests to Arrow (where functionality was added in apache/arrow-rs#6071 and apache/arrow-rs#6246). There were also two changes required to theseconds
helper function:A change which would fix both these issues (and I assume is an invariant which previously held) would be to not include whole seconds when returning nanoseconds. However, I think that breaks compat with Postgres.
Are these changes tested?
Yes, sqllogictests. The tests are not exhaustive because these features are properly tested in Arrow.
Are there any user-facing changes?
Users can use
extract
ordate_part
with intervals and durations.