|
1 | 1 | // SPDX-License-Identifier: Apache-2.0 |
2 | 2 | // SPDX-FileCopyrightText: Copyright the Vortex contributors |
3 | 3 |
|
| 4 | +use vortex_array::Array; |
4 | 5 | use vortex_array::ArrayRef; |
5 | 6 | use vortex_array::IntoArray; |
6 | 7 | use vortex_array::arrays::ConstantArray; |
7 | 8 | use vortex_array::arrays::ConstantVTable; |
8 | 9 | use vortex_array::arrays::FilterArray; |
9 | 10 | use vortex_array::arrays::FilterVTable; |
10 | 11 | use vortex_array::matchers::Exact; |
11 | | -use vortex_array::optimizer::ArrayOptimizer; |
12 | 12 | use vortex_array::optimizer::rules::ArrayParentReduceRule; |
13 | 13 | use vortex_array::optimizer::rules::ParentRuleSet; |
14 | 14 | use vortex_error::VortexExpect; |
@@ -38,19 +38,15 @@ impl ArrayParentReduceRule<DateTimePartsVTable> for DTPFilterPushDownRule { |
38 | 38 | parent: &FilterArray, |
39 | 39 | child_idx: usize, |
40 | 40 | ) -> VortexResult<Option<ArrayRef>> { |
41 | | - if child_idx != 0 { |
42 | | - return Ok(None); |
43 | | - } |
| 41 | + debug_assert_eq!(child_idx, 0); |
44 | 42 |
|
45 | 43 | if !child.seconds().is::<ConstantVTable>() || !child.subseconds().is::<ConstantVTable>() { |
46 | 44 | return Ok(None); |
47 | 45 | } |
48 | 46 |
|
49 | 47 | DateTimePartsArray::try_new( |
50 | 48 | child.dtype().clone(), |
51 | | - FilterArray::new(child.days().clone(), parent.filter_mask().clone()) |
52 | | - .into_array() |
53 | | - .optimize()?, |
| 49 | + child.days().clone().filter(parent.filter_mask().clone())?, |
54 | 50 | ConstantArray::new( |
55 | 51 | child.seconds().as_constant().vortex_expect("constant"), |
56 | 52 | parent.filter_mask().true_count(), |
|
0 commit comments