Skip to content

Commit

Permalink
feat: Add 'nulls_equal' parameter to is_in (#21426)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcrumiller authored Feb 28, 2025
1 parent e537b3b commit 4e4d259
Show file tree
Hide file tree
Showing 24 changed files with 536 additions and 131 deletions.
4 changes: 2 additions & 2 deletions crates/polars-expr/src/expressions/apply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ impl PhysicalExpr for ApplyExpr {
match function {
FunctionExpr::Boolean(BooleanFunction::IsNull) => Some(self),
#[cfg(feature = "is_in")]
FunctionExpr::Boolean(BooleanFunction::IsIn) => Some(self),
FunctionExpr::Boolean(BooleanFunction::IsIn { .. }) => Some(self),
#[cfg(feature = "is_between")]
FunctionExpr::Boolean(BooleanFunction::IsBetween { closed: _ }) => Some(self),
FunctionExpr::Boolean(BooleanFunction::IsNotNull) => Some(self),
Expand Down Expand Up @@ -573,7 +573,7 @@ impl ApplyExpr {
}
},
#[cfg(feature = "is_in")]
FunctionExpr::Boolean(BooleanFunction::IsIn) => {
FunctionExpr::Boolean(BooleanFunction::IsIn { .. }) => {
let should_read = || -> Option<bool> {
let root = expr_to_leaf_column_name(&input[0]).ok()?;

Expand Down
2 changes: 1 addition & 1 deletion crates/polars-lazy/src/tests/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ fn test_parquet_statistics() -> PolarsResult<()> {

// issue: 13427
let out = scan_foods_parquet(par)
.filter(col("calories").is_in(lit(Series::new("".into(), [0, 500]))))
.filter(col("calories").is_in(lit(Series::new("".into(), [0, 500])), false))
.collect()?;
assert_eq!(out.shape(), (0, 4));

Expand Down
2 changes: 1 addition & 1 deletion crates/polars-lazy/src/tests/predicate_queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fn test_issue_2472() -> PolarsResult<()> {
.extract(lit(r"(\d+-){4}(\w+)-"), 2)
.cast(DataType::Int32)
.alias("age");
let predicate = col("age").is_in(lit(Series::new("".into(), [2i32])));
let predicate = col("age").is_in(lit(Series::new("".into(), [2i32])), false);

let out = base
.clone()
Expand Down
6 changes: 3 additions & 3 deletions crates/polars-lazy/src/tests/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ fn test_lazy_query_8() -> PolarsResult<()> {
let mut selection = vec![];

for &c in &["A", "B", "C", "D", "E"] {
let e = when(col(c).is_in(col("E")))
let e = when(col(c).is_in(col("E"), false))
.then(col("A"))
.otherwise(Null {}.lit())
.alias(c);
Expand Down Expand Up @@ -1761,7 +1761,7 @@ fn test_is_in() -> PolarsResult<()> {
.clone()
.lazy()
.group_by_stable([col("fruits")])
.agg([col("cars").is_in(col("cars").filter(col("cars").eq(lit("beetle"))))])
.agg([col("cars").is_in(col("cars").filter(col("cars").eq(lit("beetle"))), false)])
.collect()?;
let out = out.column("cars").unwrap();
let out = out.explode()?;
Expand All @@ -1775,7 +1775,7 @@ fn test_is_in() -> PolarsResult<()> {
let out = df
.lazy()
.group_by_stable([col("fruits")])
.agg([col("cars").is_in(lit(Series::new("a".into(), ["beetle", "vw"])))])
.agg([col("cars").is_in(lit(Series::new("a".into(), ["beetle", "vw"])), false)])
.collect()?;

let out = out.column("cars").unwrap();
Expand Down
Loading

0 comments on commit 4e4d259

Please sign in to comment.