-
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
Use TwoFloats when using stats_agg
in moving-aggregate
#599
Conversation
|
||
// expanded from FlatSerializable derive macro and made to work right with generic arg | ||
#[allow(unused_imports)] | ||
unsafe impl<'a> flat_serialize::FlatSerializable<'a> for StatsSummary2D<f64> { |
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.
#[derive(FlatSerializable)]
doesn't seem to be able to handle types with generics, so I manually expanded it and fixed the output.
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.
Would it be cleaner to use the TypeHack workaround you use below?
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.
Rust doesn't support applying derive
macros on type aliases so that wouldn't work here. The ideal solution would be to fix the derive macro.
046f2cb
to
dce3089
Compare
|
||
// expanded from FlatSerializable derive macro and made to work right with generic arg | ||
#[allow(unused_imports)] | ||
unsafe impl<'a> flat_serialize::FlatSerializable<'a> for StatsSummary2D<f64> { |
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.
Would it be cleaner to use the TypeHack workaround you use below?
} | ||
|
||
fn pg2d_agg(agg: &str) -> String { | ||
format!("SELECT {}(test_y, test_x) FROM test_table", agg) | ||
format!("SELECT {agg}(test_y, test_x), (SELECT {agg}(test_y, test_x) OVER (ORDER BY test_x ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) FROM test_table LIMIT 1 OFFSET 3) FROM test_table", agg = agg) |
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 don't think this is going to be enough rows to actually see a difference and possibly will never even call the twofloat version because the condition that stops us from using the moving agg will be triggered here, I think we probably need to test with a bit more data...
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 made the floating point error threshold f64::INFINITY
in test mode – hopefully that should do the trick here?
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
30f00a1
to
32598c4
Compare
bors r+ |
Build succeeded:
|
Makes
stats_agg
useTwoFloat
s internally for keeping track of the state when in moving-aggregate mode to prevent floating-point error from accumulating. See #595 for some more details.