Skip to content

Commit

Permalink
Merge branch 'main' into uint-bloom
Browse files Browse the repository at this point in the history
  • Loading branch information
progval authored Mar 31, 2024
2 parents c1f512c + cd7a00b commit 510002c
Show file tree
Hide file tree
Showing 4 changed files with 328 additions and 292 deletions.
114 changes: 114 additions & 0 deletions datafusion/core/tests/parquet/page_pruning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,120 @@ int_tests!(16);
int_tests!(32);
int_tests!(64);

macro_rules! uint_tests {
($bits:expr) => {
paste::item! {
#[tokio::test]
// null count min max
// page-0 0 0 4
// page-1 0 1 5
// page-2 0 5 9
// page-3 0 250 254
async fn [<prune_uint $bits _lt>]() {
test_prune(
Scenario::UInt,
&format!("SELECT * FROM t where u{} < 6", $bits),
Some(0),
Some(5),
11,
)
.await;
}

#[tokio::test]
async fn [<prune_uint $bits _gt >]() {
test_prune(
Scenario::UInt,
&format!("SELECT * FROM t where u{} > 253", $bits),
Some(0),
Some(15),
1,
)
.await;
}

#[tokio::test]
async fn [<prune_uint $bits _eq >]() {
test_prune(
Scenario::UInt,
&format!("SELECT * FROM t where u{} = 6", $bits),
Some(0),
Some(15),
1,
)
.await;
}

#[tokio::test]
async fn [<prune_uint $bits _scalar_fun_and_eq >]() {
test_prune(
Scenario::UInt,
&format!("SELECT * FROM t where power(u{}, 2) = 36 and u{} = 6", $bits, $bits),
Some(0),
Some(15),
1,
)
.await;
}

#[tokio::test]
async fn [<prune_uint $bits _scalar_fun >]() {
test_prune(
Scenario::UInt,
&format!("SELECT * FROM t where power(u{}, 2) = 25", $bits),
Some(0),
Some(0),
2,
)
.await;
}

#[tokio::test]
async fn [<prune_uint $bits _complex_expr>]() {
test_prune(
Scenario::UInt,
&format!("SELECT * FROM t where u{}+1 = 6", $bits),
Some(0),
Some(0),
2,
)
.await;
}

#[tokio::test]
async fn [<prune_uint $bits _eq_in_list >]() {
// result of sql "SELECT * FROM t where in (1)"
test_prune(
Scenario::UInt,
&format!("SELECT * FROM t where u{} in (6)", $bits),
Some(0),
Some(15),
1,
)
.await;
}

#[tokio::test]
async fn [<prune_uint $bits _eq_in_list_negated >]() {
// result of sql "SELECT * FROM t where not in (6)" prune nothing
test_prune(
Scenario::UInt,
&format!("SELECT * FROM t where u{} not in (6)", $bits),
Some(0),
Some(0),
19,
)
.await;
}
}
}
}

uint_tests!(8);
uint_tests!(16);
uint_tests!(32);
uint_tests!(64);

#[tokio::test]
// null count min max
// page-0 0 -5.0 -1.0
Expand Down
2 changes: 1 addition & 1 deletion datafusion/expr/src/logical_plan/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2389,7 +2389,7 @@ impl DistinctOn {

/// Aggregates its input based on a set of grouping and aggregate
/// expressions (e.g. SUM).
#[derive(Clone, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
// mark non_exhaustive to encourage use of try_new/new()
#[non_exhaustive]
pub struct Aggregate {
Expand Down
Loading

0 comments on commit 510002c

Please sign in to comment.