Skip to content

Commit 8c42d94

Browse files
alambDandandanwaynexia
authored
Minor: remove uncessary #cfg test (#8036)
* Minor: remove uncessary #cfg test * fmt * Update datafusion/core/src/datasource/file_format/arrow.rs Co-authored-by: Ruihang Xia <[email protected]> --------- Co-authored-by: Daniël Heres <[email protected]> Co-authored-by: Ruihang Xia <[email protected]>
1 parent b2a1668 commit 8c42d94

File tree

2 files changed

+120
-132
lines changed

2 files changed

+120
-132
lines changed

datafusion/core/tests/fuzz_cases/aggregate_fuzz.rs

Lines changed: 27 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -35,39 +35,33 @@ use datafusion_physical_expr::expressions::{col, Sum};
3535
use datafusion_physical_expr::{AggregateExpr, PhysicalSortExpr};
3636
use test_utils::add_empty_batches;
3737

38-
#[cfg(test)]
39-
#[allow(clippy::items_after_test_module)]
40-
mod tests {
41-
use super::*;
42-
43-
#[tokio::test(flavor = "multi_thread", worker_threads = 8)]
44-
async fn aggregate_test() {
45-
let test_cases = vec![
46-
vec!["a"],
47-
vec!["b", "a"],
48-
vec!["c", "a"],
49-
vec!["c", "b", "a"],
50-
vec!["d", "a"],
51-
vec!["d", "b", "a"],
52-
vec!["d", "c", "a"],
53-
vec!["d", "c", "b", "a"],
54-
];
55-
let n = 300;
56-
let distincts = vec![10, 20];
57-
for distinct in distincts {
58-
let mut handles = Vec::new();
59-
for i in 0..n {
60-
let test_idx = i % test_cases.len();
61-
let group_by_columns = test_cases[test_idx].clone();
62-
let job = tokio::spawn(run_aggregate_test(
63-
make_staggered_batches::<true>(1000, distinct, i as u64),
64-
group_by_columns,
65-
));
66-
handles.push(job);
67-
}
68-
for job in handles {
69-
job.await.unwrap();
70-
}
38+
#[tokio::test(flavor = "multi_thread", worker_threads = 8)]
39+
async fn aggregate_test() {
40+
let test_cases = vec![
41+
vec!["a"],
42+
vec!["b", "a"],
43+
vec!["c", "a"],
44+
vec!["c", "b", "a"],
45+
vec!["d", "a"],
46+
vec!["d", "b", "a"],
47+
vec!["d", "c", "a"],
48+
vec!["d", "c", "b", "a"],
49+
];
50+
let n = 300;
51+
let distincts = vec![10, 20];
52+
for distinct in distincts {
53+
let mut handles = Vec::new();
54+
for i in 0..n {
55+
let test_idx = i % test_cases.len();
56+
let group_by_columns = test_cases[test_idx].clone();
57+
let job = tokio::spawn(run_aggregate_test(
58+
make_staggered_batches::<true>(1000, distinct, i as u64),
59+
group_by_columns,
60+
));
61+
handles.push(job);
62+
}
63+
for job in handles {
64+
job.await.unwrap();
7165
}
7266
}
7367
}

datafusion/core/tests/fuzz_cases/window_fuzz.rs

Lines changed: 93 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -44,108 +44,102 @@ use hashbrown::HashMap;
4444
use rand::rngs::StdRng;
4545
use rand::{Rng, SeedableRng};
4646

47-
#[cfg(test)]
48-
#[allow(clippy::items_after_test_module)]
49-
mod tests {
50-
use super::*;
51-
52-
use datafusion_physical_plan::windows::PartitionSearchMode::{
53-
Linear, PartiallySorted, Sorted,
54-
};
47+
use datafusion_physical_plan::windows::PartitionSearchMode::{
48+
Linear, PartiallySorted, Sorted,
49+
};
5550

56-
#[tokio::test(flavor = "multi_thread", worker_threads = 16)]
57-
async fn window_bounded_window_random_comparison() -> Result<()> {
58-
// make_staggered_batches gives result sorted according to a, b, c
59-
// In the test cases first entry represents partition by columns
60-
// Second entry represents order by columns.
61-
// Third entry represents search mode.
62-
// In sorted mode physical plans are in the form for WindowAggExec
63-
//```
64-
// WindowAggExec
65-
// MemoryExec]
66-
// ```
67-
// and in the form for BoundedWindowAggExec
68-
// ```
69-
// BoundedWindowAggExec
70-
// MemoryExec
71-
// ```
72-
// In Linear and PartiallySorted mode physical plans are in the form for WindowAggExec
73-
//```
74-
// WindowAggExec
75-
// SortExec(required by window function)
76-
// MemoryExec]
77-
// ```
78-
// and in the form for BoundedWindowAggExec
79-
// ```
80-
// BoundedWindowAggExec
81-
// MemoryExec
82-
// ```
83-
let test_cases = vec![
84-
(vec!["a"], vec!["a"], Sorted),
85-
(vec!["a"], vec!["b"], Sorted),
86-
(vec!["a"], vec!["a", "b"], Sorted),
87-
(vec!["a"], vec!["b", "c"], Sorted),
88-
(vec!["a"], vec!["a", "b", "c"], Sorted),
89-
(vec!["b"], vec!["a"], Linear),
90-
(vec!["b"], vec!["a", "b"], Linear),
91-
(vec!["b"], vec!["a", "c"], Linear),
92-
(vec!["b"], vec!["a", "b", "c"], Linear),
93-
(vec!["c"], vec!["a"], Linear),
94-
(vec!["c"], vec!["a", "b"], Linear),
95-
(vec!["c"], vec!["a", "c"], Linear),
96-
(vec!["c"], vec!["a", "b", "c"], Linear),
97-
(vec!["b", "a"], vec!["a"], Sorted),
98-
(vec!["b", "a"], vec!["b"], Sorted),
99-
(vec!["b", "a"], vec!["c"], Sorted),
100-
(vec!["b", "a"], vec!["a", "b"], Sorted),
101-
(vec!["b", "a"], vec!["b", "c"], Sorted),
102-
(vec!["b", "a"], vec!["a", "c"], Sorted),
103-
(vec!["b", "a"], vec!["a", "b", "c"], Sorted),
104-
(vec!["c", "b"], vec!["a"], Linear),
105-
(vec!["c", "b"], vec!["a", "b"], Linear),
106-
(vec!["c", "b"], vec!["a", "c"], Linear),
107-
(vec!["c", "b"], vec!["a", "b", "c"], Linear),
108-
(vec!["c", "a"], vec!["a"], PartiallySorted(vec![1])),
109-
(vec!["c", "a"], vec!["b"], PartiallySorted(vec![1])),
110-
(vec!["c", "a"], vec!["c"], PartiallySorted(vec![1])),
111-
(vec!["c", "a"], vec!["a", "b"], PartiallySorted(vec![1])),
112-
(vec!["c", "a"], vec!["b", "c"], PartiallySorted(vec![1])),
113-
(vec!["c", "a"], vec!["a", "c"], PartiallySorted(vec![1])),
114-
(
115-
vec!["c", "a"],
116-
vec!["a", "b", "c"],
117-
PartiallySorted(vec![1]),
118-
),
119-
(vec!["c", "b", "a"], vec!["a"], Sorted),
120-
(vec!["c", "b", "a"], vec!["b"], Sorted),
121-
(vec!["c", "b", "a"], vec!["c"], Sorted),
122-
(vec!["c", "b", "a"], vec!["a", "b"], Sorted),
123-
(vec!["c", "b", "a"], vec!["b", "c"], Sorted),
124-
(vec!["c", "b", "a"], vec!["a", "c"], Sorted),
125-
(vec!["c", "b", "a"], vec!["a", "b", "c"], Sorted),
126-
];
127-
let n = 300;
128-
let n_distincts = vec![10, 20];
129-
for n_distinct in n_distincts {
130-
let mut handles = Vec::new();
131-
for i in 0..n {
132-
let idx = i % test_cases.len();
133-
let (pb_cols, ob_cols, search_mode) = test_cases[idx].clone();
134-
let job = tokio::spawn(run_window_test(
135-
make_staggered_batches::<true>(1000, n_distinct, i as u64),
136-
i as u64,
137-
pb_cols,
138-
ob_cols,
139-
search_mode,
140-
));
141-
handles.push(job);
142-
}
143-
for job in handles {
144-
job.await.unwrap()?;
145-
}
51+
#[tokio::test(flavor = "multi_thread", worker_threads = 16)]
52+
async fn window_bounded_window_random_comparison() -> Result<()> {
53+
// make_staggered_batches gives result sorted according to a, b, c
54+
// In the test cases first entry represents partition by columns
55+
// Second entry represents order by columns.
56+
// Third entry represents search mode.
57+
// In sorted mode physical plans are in the form for WindowAggExec
58+
//```
59+
// WindowAggExec
60+
// MemoryExec]
61+
// ```
62+
// and in the form for BoundedWindowAggExec
63+
// ```
64+
// BoundedWindowAggExec
65+
// MemoryExec
66+
// ```
67+
// In Linear and PartiallySorted mode physical plans are in the form for WindowAggExec
68+
//```
69+
// WindowAggExec
70+
// SortExec(required by window function)
71+
// MemoryExec]
72+
// ```
73+
// and in the form for BoundedWindowAggExec
74+
// ```
75+
// BoundedWindowAggExec
76+
// MemoryExec
77+
// ```
78+
let test_cases = vec![
79+
(vec!["a"], vec!["a"], Sorted),
80+
(vec!["a"], vec!["b"], Sorted),
81+
(vec!["a"], vec!["a", "b"], Sorted),
82+
(vec!["a"], vec!["b", "c"], Sorted),
83+
(vec!["a"], vec!["a", "b", "c"], Sorted),
84+
(vec!["b"], vec!["a"], Linear),
85+
(vec!["b"], vec!["a", "b"], Linear),
86+
(vec!["b"], vec!["a", "c"], Linear),
87+
(vec!["b"], vec!["a", "b", "c"], Linear),
88+
(vec!["c"], vec!["a"], Linear),
89+
(vec!["c"], vec!["a", "b"], Linear),
90+
(vec!["c"], vec!["a", "c"], Linear),
91+
(vec!["c"], vec!["a", "b", "c"], Linear),
92+
(vec!["b", "a"], vec!["a"], Sorted),
93+
(vec!["b", "a"], vec!["b"], Sorted),
94+
(vec!["b", "a"], vec!["c"], Sorted),
95+
(vec!["b", "a"], vec!["a", "b"], Sorted),
96+
(vec!["b", "a"], vec!["b", "c"], Sorted),
97+
(vec!["b", "a"], vec!["a", "c"], Sorted),
98+
(vec!["b", "a"], vec!["a", "b", "c"], Sorted),
99+
(vec!["c", "b"], vec!["a"], Linear),
100+
(vec!["c", "b"], vec!["a", "b"], Linear),
101+
(vec!["c", "b"], vec!["a", "c"], Linear),
102+
(vec!["c", "b"], vec!["a", "b", "c"], Linear),
103+
(vec!["c", "a"], vec!["a"], PartiallySorted(vec![1])),
104+
(vec!["c", "a"], vec!["b"], PartiallySorted(vec![1])),
105+
(vec!["c", "a"], vec!["c"], PartiallySorted(vec![1])),
106+
(vec!["c", "a"], vec!["a", "b"], PartiallySorted(vec![1])),
107+
(vec!["c", "a"], vec!["b", "c"], PartiallySorted(vec![1])),
108+
(vec!["c", "a"], vec!["a", "c"], PartiallySorted(vec![1])),
109+
(
110+
vec!["c", "a"],
111+
vec!["a", "b", "c"],
112+
PartiallySorted(vec![1]),
113+
),
114+
(vec!["c", "b", "a"], vec!["a"], Sorted),
115+
(vec!["c", "b", "a"], vec!["b"], Sorted),
116+
(vec!["c", "b", "a"], vec!["c"], Sorted),
117+
(vec!["c", "b", "a"], vec!["a", "b"], Sorted),
118+
(vec!["c", "b", "a"], vec!["b", "c"], Sorted),
119+
(vec!["c", "b", "a"], vec!["a", "c"], Sorted),
120+
(vec!["c", "b", "a"], vec!["a", "b", "c"], Sorted),
121+
];
122+
let n = 300;
123+
let n_distincts = vec![10, 20];
124+
for n_distinct in n_distincts {
125+
let mut handles = Vec::new();
126+
for i in 0..n {
127+
let idx = i % test_cases.len();
128+
let (pb_cols, ob_cols, search_mode) = test_cases[idx].clone();
129+
let job = tokio::spawn(run_window_test(
130+
make_staggered_batches::<true>(1000, n_distinct, i as u64),
131+
i as u64,
132+
pb_cols,
133+
ob_cols,
134+
search_mode,
135+
));
136+
handles.push(job);
137+
}
138+
for job in handles {
139+
job.await.unwrap()?;
146140
}
147-
Ok(())
148141
}
142+
Ok(())
149143
}
150144

151145
fn get_random_function(

0 commit comments

Comments
 (0)