diff --git a/python/cudf_polars/cudf_polars/dsl/expressions/boolean.py b/python/cudf_polars/cudf_polars/dsl/expressions/boolean.py index c309c6f9db3..483ea022b1d 100644 --- a/python/cudf_polars/cudf_polars/dsl/expressions/boolean.py +++ b/python/cudf_polars/cudf_polars/dsl/expressions/boolean.py @@ -374,8 +374,12 @@ def do_evaluate( elif self.name is BooleanFunction.Name.Not: (column,) = columns return Column( - plc.unary.unary_operation( - column.obj, plc.unary.UnaryOperator.NOT, stream=df.stream + plc.unary.cast( + plc.unary.unary_operation( + column.obj, plc.unary.UnaryOperator.NOT, stream=df.stream + ), + self.dtype.plc_type, + stream=df.stream, ), dtype=self.dtype, ) diff --git a/python/cudf_polars/tests/test_select.py b/python/cudf_polars/tests/test_select.py index 10fcf9f660d..d01e3790047 100644 --- a/python/cudf_polars/tests/test_select.py +++ b/python/cudf_polars/tests/test_select.py @@ -68,6 +68,18 @@ def test_select_reduce(): assert_gpu_result_equal(query) +@pytest.mark.xfail( + reason=( + "Probably won't be fixed until 1.35.1 " + "https://github.com/pola-rs/polars/issues/24964" + ) +) +def test_select_reduce_unary_not(): + ldf = pl.LazyFrame({"c0": [1]}) + query = ldf.select((~(pl.lit(1))).min().alias("literal")) + assert_gpu_result_equal(query) + + def test_select_with_cse_no_agg(): df = pl.LazyFrame({"a": [1, 2, 3]}) expr = pl.col("a") + pl.col("a")