Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support =, <, <=, >, >=, !=, is distinct from, is not distinct from for BooleanArray #1163

Merged
merged 5 commits into from
Nov 20, 2021
Merged
Show file tree
Hide file tree
Changes from 3 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
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);
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