Skip to content

Commit f767c2e

Browse files
committed
port next test
1 parent b73f79f commit f767c2e

File tree

3 files changed

+28
-10
lines changed

3 files changed

+28
-10
lines changed

parquet/src/arrow/arrow_reader/selection.rs

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1624,17 +1624,35 @@ mod tests {
16241624

16251625
#[test]
16261626
#[should_panic(expected = "selection exceeds the number of selected rows")]
1627-
fn test_and_longer() {
1628-
let a = RowSelectorSelection::from(vec![
1629-
RowSelector::select(3),
1630-
RowSelector::skip(33),
1631-
RowSelector::select(3),
1632-
RowSelector::skip(33),
1633-
]);
1634-
let b = RowSelectorSelection::from(vec![RowSelector::select(36)]);
1627+
fn test_and_longer_selectors() {
1628+
let (a, b) = longer_selectors();
1629+
let a = force_selectors(a);
1630+
let b = force_selectors(b);
16351631
a.and_then(&b);
16361632
}
16371633

1634+
#[test]
1635+
#[should_panic(expected = "The 'other' selection must have exactly as many set bits as 'self'")]
1636+
fn test_and_longer_mask() {
1637+
let (a, b) = longer_selectors();
1638+
let a = force_mask(a);
1639+
let b = force_mask(b);
1640+
a.and_then(&b);
1641+
}
1642+
1643+
/// Returns two RowSelections where the first is longer than the second
1644+
fn longer_selectors() -> (RowSelection, RowSelection) {
1645+
(
1646+
RowSelection::from(vec![
1647+
RowSelector::select(3),
1648+
RowSelector::skip(33),
1649+
RowSelector::select(3),
1650+
RowSelector::skip(33),
1651+
]),
1652+
RowSelection::from(vec![RowSelector::select(36)]),
1653+
)
1654+
}
1655+
16381656
#[test]
16391657
#[should_panic(expected = "selection contains less than the number of selected rows")]
16401658
fn test_and_shorter() {

parquet/src/arrow/arrow_reader/selection/and_then.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
//! Xiangpeng Hao in <https://github.com/apache/arrow-rs/pull/6624> and
2020
//! [LiquidCache's implementation](https://github.com/XiangpengHao/liquid-cache/blob/60323cdb5f17f88af633ad9acbc7d74f684f9912/src/parquet/src/utils.rs#L17)
2121
22-
use arrow_buffer::{BooleanBuffer, BooleanBufferBuilder, MutableBuffer};
2322
use arrow_buffer::bit_util::{apply_bitwise_binary_op, apply_bitwise_unary_op};
23+
use arrow_buffer::{BooleanBuffer, BooleanBufferBuilder, MutableBuffer};
2424

2525
fn boolean_buffer_and_then_fallback(left: &BooleanBuffer, right: &BooleanBuffer) -> BooleanBuffer {
2626
debug_assert_eq!(

parquet/src/arrow/arrow_reader/selection/mask.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
use std::fmt::Debug;
1918
use crate::arrow::arrow_reader::RowSelector;
2019
use crate::arrow::arrow_reader::selection::and_then::boolean_buffer_and_then;
2120
use crate::arrow::arrow_reader::selection::conversion::{
@@ -24,6 +23,7 @@ use crate::arrow::arrow_reader::selection::conversion::{
2423
use arrow_array::{Array, BooleanArray};
2524
use arrow_buffer::bit_iterator::{BitIndexIterator, BitSliceIterator};
2625
use arrow_buffer::{BooleanBuffer, BooleanBufferBuilder};
26+
use std::fmt::Debug;
2727
use std::ops::Range;
2828

2929
/// [`RowSelection`] based on a [`BooleanArray`]

0 commit comments

Comments
 (0)