-
Notifications
You must be signed in to change notification settings - Fork 188
Introduce EnterTime, fix Negate #587
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
//! Enter a collection into a scope. | ||
|
||
use timely::Data; | ||
use timely::dataflow::{Scope, ScopeParent, Stream, StreamCore}; | ||
use timely::dataflow::operators::core::{Enter, Map}; | ||
use timely::dataflow::scopes::Child; | ||
use timely::progress::timestamp::Refines; | ||
|
||
/// Extension trait for streams. | ||
pub trait EnterTime<C, G, TInner> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As with the |
||
where | ||
G: ScopeParent, | ||
TInner: Refines<G::Timestamp>, | ||
{ | ||
/// The containers in the output stream. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar nit: probably something better to say here. Perhaps
|
||
type Container: Clone; | ||
|
||
/// Brings a stream into a nested scope. | ||
/// | ||
/// # Examples | ||
/// | ||
/// ``` | ||
/// use timely::dataflow::Scope; | ||
/// use differential_dataflow::input::Input; | ||
/// | ||
/// ::timely::example(|scope| { | ||
/// | ||
/// let data = scope.new_collection_from(1 .. 10).1; | ||
/// | ||
/// let result = scope.region(|child| { | ||
/// data.enter(child) | ||
/// .leave() | ||
/// }); | ||
/// | ||
/// data.assert_eq(&result); | ||
/// }); | ||
/// ``` | ||
fn enter_time<'a>(&self, child: &Child<'a, G, TInner>) -> StreamCore<Child<'a, G, TInner>, Self::Container>; | ||
} | ||
|
||
impl<G, D, R, TInner> EnterTime<Vec<(D, G::Timestamp, R)>, G, TInner> for Stream<G, (D, G::Timestamp, R)> | ||
where | ||
G: Scope, | ||
D: Data, | ||
R: Data, | ||
TInner: Refines<G::Timestamp>, | ||
{ | ||
type Container = Vec<(D, TInner, R)>; | ||
|
||
fn enter_time<'a>(&self, child: &Child<'a, G, TInner>) -> Stream<Child<'a, G, TInner>, (D, TInner, R)> { | ||
self.enter(child) | ||
.map(|(data, time, diff)| (data, TInner::to_inner(time), diff)) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -169,7 +169,7 @@ where | |
impl<G: Scope, D: Data, R: Abelian, C: Container + Clone + 'static> Variable<G, D, R, C> | ||
where | ||
G::Timestamp: Lattice, | ||
StreamCore<G, C>: crate::operators::Negate<G, C> + ResultsIn<G, C>, | ||
StreamCore<G, C>: crate::operators::Negate<C, G> + ResultsIn<G, C>, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think conventionally, we usually have scope parameters first and containers later (e.g. timely's |
||
{ | ||
/// Creates a new initially empty `Variable`. | ||
/// | ||
|
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.
Nit, but doccomment could use some love.