-
Notifications
You must be signed in to change notification settings - Fork 53
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
Upgrade to pgx 0.5.0 #547
Upgrade to pgx 0.5.0 #547
Conversation
@@ -4,6 +4,10 @@ | |||
#![allow(clippy::extra_unused_lifetimes)] | |||
// every function calling in_aggregate_context should be unsafe | |||
#![allow(clippy::not_unsafe_ptr_arg_deref)] | |||
// since 0.5 pgx requires non-elided lifetimes on extern functions: https://github.com/tcdi/pgx/issues/721 | |||
#![allow(clippy::needless_lifetimes)] |
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.
pgx 0.5.0 now requires there to be explicit lifetimes in some cases, despite Clippy claiming they can be removed. I added explicit lifetimes to all of the (many) functions that require them now.
Current status:
|
559: Basic test for space saving aggregate serialization r=Smittyvb a=Smittyvb I noticed while working on #547 that we don't have any tests for `SpaceSavingAggregate`s. This PR adds a simple test to verify that the `raw_freq_agg` function will at least run without failing. This test currently fails on #547, which is good since that PR causes a bug that leads to `SpaceSavingAggregate` not working at all. Co-authored-by: Smitty <smitty@timescale.com>
eb6c2e9
to
f81179a
Compare
@JLockerman can we get your eyes on this next week? Thanks! |
__CARGO_FIX_YOLO=1 cargo fix --broken-code
The CI now passes when I manually run it using the testing Docker image from #571: https://github.com/timescale/timescaledb-toolkit/actions/runs/3230387310/jobs/5288778595 |
extension/src/state_aggregate.rs
Outdated
TableIterator::new(agg.durations.clone().into_iter().map(move |record| { | ||
let beg = record.state_beg as usize; | ||
let end = record.state_end as usize; | ||
(states[beg..end].to_owned(), record.duration) | ||
})) | ||
TableIterator::new( | ||
agg.durations | ||
.clone() | ||
.into_iter() | ||
.map(move |record| { | ||
let beg = record.state_beg as usize; | ||
let end = record.state_end as usize; | ||
(states[beg..end].to_owned(), record.duration) | ||
}) | ||
.collect::<Vec<_>>() | ||
.into_iter(), | ||
) |
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.
pgx requires that a TableIterator
/SetOfIterator
only see values allocated from Rust (otherwise you get use-after-frees). To comply with this requirement I collect the iterator into a Vec
then turn it back into an iterator.
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.
Really nice work.
Note that pgx |
571: Update Docker image for pgx 0.5.0 r=Smittyvb a=Smittyvb pgx 0.5.0 just released! This PR updates the CI to have pgx 0.5.0 and adds pgx 0.5.0 to the `$PATH` instead of pgx 0.4.5. This PR should be merged right before merging #547 so that the CI can pass on that PR before merging it. Co-authored-by: Smitty <smitty@timescale.com>
bors r+ |
Build succeeded: |
Upgrades to pgx
0.5.0-beta.1
(0.5.0 will hopefully be released in 0-7 days). I originally tested on another branch with a lot of code commented out; this branch cherry picks the commits that fix errors but not the ones that comment code out.To do:
datum_utils.rs
(Include type when getting argument pgcentralfoundation/pgrx#740)Copy
on some typesFuture work:
crate::raw
#[pg_aggregate]
instead of our own aggregate builder macro