-
Notifications
You must be signed in to change notification settings - Fork 219
perf: batch fragmented CASE branch execution #9820
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: develop
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 |
|---|---|---|
|
|
@@ -27,7 +27,7 @@ pub(super) const RULES: ReduceRuleSet<ScalarFn> = | |
| ReduceRuleSet::new(&[&ScalarFnPackToStructRule, &ScalarFnAbstractReduceRule]); | ||
|
|
||
| pub(super) const PARENT_RULES: ParentRuleSet<ScalarFn> = ParentRuleSet::new(&[ | ||
| ParentRuleSet::lift(&ScalarFnUnaryFilterPushDownRule), | ||
| ParentRuleSet::lift(&ScalarFnFilterPushDownRule), | ||
| ParentRuleSet::lift(&ScalarFnSliceReduceRule), | ||
| ]); | ||
|
|
||
|
|
@@ -95,9 +95,9 @@ impl ArrayReduceRule<ScalarFn> for ScalarFnAbstractReduceRule { | |
| } | ||
|
|
||
| #[derive(Debug)] | ||
| struct ScalarFnUnaryFilterPushDownRule; | ||
| struct ScalarFnFilterPushDownRule; | ||
|
Contributor
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. can this be a separate pr?
Contributor
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. |
||
|
|
||
| impl ArrayParentReduceRule<ScalarFn> for ScalarFnUnaryFilterPushDownRule { | ||
| impl ArrayParentReduceRule<ScalarFn> for ScalarFnFilterPushDownRule { | ||
| type Parent = Filter; | ||
|
|
||
| fn reduce_parent( | ||
|
|
@@ -106,31 +106,21 @@ impl ArrayParentReduceRule<ScalarFn> for ScalarFnUnaryFilterPushDownRule { | |
| parent: ArrayView<'_, Filter>, | ||
| _child_idx: usize, | ||
| ) -> VortexResult<Option<ArrayRef>> { | ||
| // If we only have one non-constant child, then it is _always_ cheaper to push down the | ||
| // filter over the children of the scalar function array. | ||
| if child | ||
| // Selection precedes value evaluation, including errors in unselected rows. | ||
| let new_children: Vec<_> = child | ||
| .iter_children() | ||
| .filter(|c| !c.is::<Constant>()) | ||
| .count() | ||
| == 1 | ||
| { | ||
| let new_children: Vec<_> = child | ||
| .iter_children() | ||
| .map(|c| match c.as_opt::<Constant>() { | ||
| Some(array) => { | ||
| Ok(ConstantArray::new(array.scalar().clone(), parent.len()).into_array()) | ||
| } | ||
| None => c.filter(parent.filter_mask().clone()), | ||
| }) | ||
| .try_collect()?; | ||
|
|
||
| let new_array = | ||
| ScalarFnArray::try_new(child.scalar_fn().clone(), new_children)?.into_array(); | ||
|
|
||
| return Ok(Some(new_array)); | ||
| } | ||
| .map(|c| match c.as_opt::<Constant>() { | ||
|
Contributor
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. change this to call prepare_mask_for_reuse if nchildren > 1 |
||
| Some(array) => { | ||
| Ok(ConstantArray::new(array.scalar().clone(), parent.len()).into_array()) | ||
| } | ||
| None => c.filter(parent.filter_mask().clone()), | ||
| }) | ||
| .try_collect()?; | ||
|
|
||
| Ok(None) | ||
| Ok(Some( | ||
| ScalarFnArray::try_new_with_len(child.scalar_fn().clone(), new_children, parent.len())? | ||
| .into_array(), | ||
| )) | ||
| } | ||
| } | ||
|
|
||
|
|
||
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.
can you make this a separate pr, also while you're at it fix MaskValues::last to use BitBuffer::last_set_index
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.
actually you can leverage
contiguous_values_rangehereThere 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.
#9831