Skip to content

Commit

Permalink
refactor: Fix/skip variety of new-streaming tests (#18924)
Browse files Browse the repository at this point in the history
  • Loading branch information
orlp authored Sep 25, 2024
1 parent 011e366 commit 2467b27
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 7 deletions.
2 changes: 1 addition & 1 deletion crates/polars-plan/src/plans/python/pyarrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub fn predicate_to_pa(
} else {
let mut list_repr = String::with_capacity(s.len() * 5);
list_repr.push('[');
for av in s.iter() {
for av in s.rechunk().iter() {
if let AnyValue::Boolean(v) = av {
let s = if v { "True" } else { "False" };
write!(list_repr, "{},", s).unwrap();
Expand Down
18 changes: 14 additions & 4 deletions crates/polars-stream/src/physical_plan/lower_expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,23 @@ pub(crate) fn is_elementwise(
function: _,
output_type: _,
options,
}
| AExpr::Function {
} => {
options.is_elementwise() && input.iter().all(|e| is_elementwise(e.node(), arena, cache))
},
AExpr::Function {
input,
function: _,
function,
options,
} => {
options.is_elementwise() && input.iter().all(|e| is_elementwise(e.node(), arena, cache))
match function {
// Non-strict strptime must be done in-memory to ensure the format
// is consistent across the entire dataframe.
FunctionExpr::StringExpr(StringFunction::Strptime(_, opts)) => opts.strict,
_ => {
options.is_elementwise()
&& input.iter().all(|e| is_elementwise(e.node(), arena, cache))
},
}
},

AExpr::Window { .. } => false,
Expand Down
1 change: 1 addition & 0 deletions py-polars/tests/unit/io/test_parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ def test_to_from_buffer(

@pytest.mark.parametrize("use_pyarrow", [True, False])
@pytest.mark.parametrize("rechunk_and_expected_chunks", [(True, 1), (False, 3)])
@pytest.mark.may_fail_auto_streaming
def test_read_parquet_respects_rechunk_16416(
use_pyarrow: bool, rechunk_and_expected_chunks: tuple[bool, int]
) -> None:
Expand Down
1 change: 1 addition & 0 deletions py-polars/tests/unit/lazyframe/test_lazyframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ def test_inspect(capsys: CaptureFixture[str]) -> None:
assert len(res.out) > 0


@pytest.mark.may_fail_auto_streaming
def test_fetch(fruits_cars: pl.DataFrame) -> None:
res = fruits_cars.lazy().select("*")._fetch(2)
assert_frame_equal(res, res[:2])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,7 @@ def test_list_unique2() -> None:
assert sorted(result[1]) == [1, 2]


@pytest.mark.may_fail_auto_streaming
def test_list_to_struct() -> None:
df = pl.DataFrame({"n": [[0, 1, 2], [0, 1]]})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ def test_str_to_integer_base_expr() -> None:
# test strict raise
df = pl.DataFrame({"str": ["110", "ff00", "cafe", None], "base": [2, 10, 10, 8]})

with pytest.raises(ComputeError, match="failed for 2 value"):
with pytest.raises(ComputeError):
df.select(pl.col("str").str.to_integer(base="base"))


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def test_to_date_all_inferred_date_patterns(time_string: str, expected: date) ->
],
)
def test_non_exact_short_elements_10223(value: str, attr: str) -> None:
with pytest.raises(InvalidOperationError, match="conversion .* failed"):
with pytest.raises((InvalidOperationError, ComputeError)):
getattr(pl.Series(["2019-01-01", value]).str, attr)(exact=False)


Expand Down

0 comments on commit 2467b27

Please sign in to comment.