Skip to content

Commit

Permalink
Support =, <, <=, >, >=, !=, is distinct from, `is not …
Browse files Browse the repository at this point in the history
…distinct from` for `BooleanArray`
  • Loading branch information
alamb committed Nov 15, 2021
1 parent 2e63ea9 commit c990851
Show file tree
Hide file tree
Showing 6 changed files with 592 additions and 27 deletions.
4 changes: 2 additions & 2 deletions datafusion/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ avro = ["avro-rs", "num-traits"]
[dependencies]
ahash = "0.7"
hashbrown = { version = "0.11", features = ["raw"] }
arrow = { version = "6.1.0", features = ["prettyprint"] }
parquet = { version = "6.1.0", features = ["arrow"] }
arrow = { version = "6.2.0", features = ["prettyprint"] }
parquet = { version = "6.2.0", features = ["arrow"] }
sqlparser = "0.12"
paste = "^1.0"
num_cpus = "1.13.0"
Expand Down
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);
}

#[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

0 comments on commit c990851

Please sign in to comment.