Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 6 additions & 18 deletions datafusion/src/physical_optimizer/pruning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1374,36 +1374,24 @@ mod tests {

#[test]
fn prune_bool_column_eq_true() {
let (schema, statistics, _, _) = bool_setup();
let (schema, statistics, expected_true, _) = bool_setup();

// b1 = true
let expr = col("b1").eq(lit(true));
let p = PruningPredicate::try_new(&expr, schema).unwrap();
let result = p.prune(&statistics).unwrap_err();
assert!(
result.to_string().contains(
"Data type Boolean not supported for scalar operation 'lt_eq' on dyn array"
),
"{}",
result
)
let result = p.prune(&statistics).unwrap();
assert_eq!(result, expected_true);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pruning works for boolean columns now

}

#[test]
fn prune_bool_not_column_eq_true() {
let (schema, statistics, _, _) = bool_setup();
let (schema, statistics, _, expected_false) = bool_setup();

// !b1 = true
let expr = col("b1").not().eq(lit(true));
let p = PruningPredicate::try_new(&expr, schema).unwrap();
let result = p.prune(&statistics).unwrap_err();
assert!(
result.to_string().contains(
"Data type Boolean not supported for scalar operation 'lt_eq' on dyn array"
),
"{}",
result
)
let result = p.prune(&statistics).unwrap();
assert_eq!(result, expected_false);
}

/// Creates setup for int32 chunk pruning
Expand Down
Loading