-
Notifications
You must be signed in to change notification settings - Fork 33
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
feat: add join_multiset() #804
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
use syn::{parse_quote, parse_quote_spanned}; | ||
|
||
use super::{ | ||
FlowProperties, FlowPropertyVal, OperatorCategory, OperatorConstraints, WriteContextArgs, | ||
RANGE_0, RANGE_1, | ||
}; | ||
use crate::graph::{OpInstGenerics, OperatorInstance}; | ||
|
||
/// > 2 input streams of type <(K, V1)> and <(K, V2)>, 1 output stream of type <(K, (V1, V2))> | ||
/// | ||
/// This operator is equivalent to `join` except that the LHS and RHS are collected into multisets rather than sets before joining. | ||
/// | ||
/// For example: | ||
/// ```hydroflow | ||
/// lhs = source_iter([("a", 0), ("a", 0)]) -> tee(); | ||
/// rhs = source_iter([("a", "hydro")]) -> tee(); | ||
/// | ||
/// lhs -> [0]multiset_join; | ||
/// rhs -> [1]multiset_join; | ||
/// multiset_join = join_multiset() -> assert([("a", (0, "hydro")), ("a", (0, "hydro"))]); | ||
/// | ||
/// lhs -> [0]set_join; | ||
/// rhs -> [1]set_join; | ||
/// set_join = join() -> assert([("a", (0, "hydro"))]); | ||
/// ``` | ||
pub const JOIN_MULTISET: OperatorConstraints = OperatorConstraints { | ||
name: "join_multiset", | ||
categories: &[OperatorCategory::MultiIn], | ||
hard_range_inn: &(2..=2), | ||
soft_range_inn: &(2..=2), | ||
hard_range_out: RANGE_1, | ||
soft_range_out: RANGE_1, | ||
num_args: 0, | ||
persistence_args: &(0..=2), | ||
type_args: RANGE_0, | ||
is_external_input: false, | ||
ports_inn: Some(|| super::PortListSpec::Fixed(parse_quote! { 0, 1 })), | ||
ports_out: None, | ||
properties: FlowProperties { | ||
deterministic: FlowPropertyVal::Preserve, | ||
monotonic: FlowPropertyVal::Preserve, | ||
inconsistency_tainted: false, | ||
}, | ||
input_delaytype_fn: |_| None, | ||
write_fn: |wc @ &WriteContextArgs { | ||
root, | ||
op_span, | ||
op_inst: op_inst @ OperatorInstance { .. }, | ||
.. | ||
}, | ||
diagnostics| { | ||
let join_type = parse_quote_spanned! {op_span=> // Uses `lat_type.span()`! | ||
#root::compiled::pull::HalfMultisetJoinState | ||
}; | ||
|
||
let wc = WriteContextArgs { | ||
op_inst: &OperatorInstance { | ||
generics: OpInstGenerics { | ||
type_args: vec![join_type], | ||
..wc.op_inst.generics.clone() | ||
}, | ||
..op_inst.clone() | ||
}, | ||
..wc.clone() | ||
}; | ||
|
||
(super::join::JOIN.write_fn)(&wc, diagnostics) | ||
}, | ||
}; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
hmm order is preserved I think so multisets might not be the right word
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.
Given that there are many (multiset) join algorithms, that seems like a side-effect of the implementation that we may not want to provide as a guarantee, so I wouldn't sweat it.