-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[Minor] Move combine_join util to under equivalence.rs #7917
[Minor] Move combine_join util to under equivalence.rs #7917
Conversation
@@ -885,6 +885,240 @@ fn req_satisfied(given: LexOrderingRef, req: &[PhysicalSortRequirement]) -> bool | |||
true | |||
} | |||
|
|||
/// Combine equivalence properties of the given join inputs. | |||
pub fn combine_join_equivalence_properties( |
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.
This function is copy-pasted
} | ||
|
||
/// Calculate equivalence properties for the given cross join operation. | ||
pub fn cross_join_equivalence_properties( |
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.
This function is copy-pasted
/// | ||
/// This way; once we normalize an expression according to equivalence properties, | ||
/// it can thereafter safely be used for ordering equivalence normalization. | ||
fn get_updated_right_ordering_equivalent_class( |
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.
This function is copy pasted
for left_ordering in left_oeq_class.iter() { | ||
for right_ordering in updated_right_oeq.iter() { | ||
let mut ordering = left_ordering.to_vec(); | ||
ordering.extend(right_ordering.to_vec()); | ||
let ordering_normalized = | ||
join_eq_properties.normalize_sort_exprs(&ordering); | ||
orderings.push(ordering_normalized); | ||
} | ||
} |
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.
Previously we were prefixing with left ordering. We now prefix with all of the orderings inside left equivalence. We no longer use left output_ordering. This is the only change. in this function.
for right_ordering in right_oeg_class.iter() { | ||
for left_ordering in left_oeq_class.iter() { | ||
let mut ordering = right_ordering.to_vec(); | ||
ordering.extend(left_ordering.to_vec()); | ||
let ordering_normalized = | ||
join_eq_properties.normalize_sort_exprs(&ordering); | ||
orderings.push(ordering_normalized); | ||
} | ||
} |
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.
Similar to above comment. However, in this case left orderings are prefixed with right orderings
@@ -1131,4 +1365,82 @@ mod tests { | |||
} | |||
Ok(()) | |||
} | |||
|
|||
#[test] | |||
fn test_get_updated_right_ordering_equivalence_properties() -> Result<()> { |
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.
This test is copy-pasted
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 like a nice change to me -- thank you @mustafasrepo
Which issue does this PR close?
Closes #.
Rationale for this change
Utils to construct
join_equivalence
andjoin_ordering_equivalence
are move underequivalence.rs
file. Computations regarding the equivalence and ordering equivalence are gathered in theequivalence.rs
file. With this change code organization is bit better.What changes are included in this PR?
Are these changes tested?
Are there any user-facing changes?