Skip to content

Commit 88df3b9

Browse files
committed
linting
1 parent 8313cc9 commit 88df3b9

2 files changed

Lines changed: 28 additions & 12 deletions

File tree

src/daft-recordbatch/src/ops/window_states/first_last_value.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ impl WindowAggStateOps for LastValueWindowState {
109109
}
110110

111111
fn remove(&mut self, _start_idx: usize, end_idx: usize) -> DaftResult<()> {
112-
if let Some(last) = self.last_idx {
113-
if last < end_idx {
114-
self.last_idx = None;
115-
}
112+
if let Some(last) = self.last_idx
113+
&& last < end_idx
114+
{
115+
self.last_idx = None;
116116
}
117117
Ok(())
118118
}

tests/dataframe/test_window_first_last_value.py

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,49 +31,65 @@ def make_df(values: list) -> daft.DataFrame:
3131

3232
def test_last_value_rejected_in_global_agg():
3333
df = daft.from_pydict({"x": [1, 2, 3]})
34-
with pytest.raises(DaftCoreException, match="Expressions in aggregations must be composed of non-nested aggregation expressions"):
34+
with pytest.raises(
35+
DaftCoreException, match="Expressions in aggregations must be composed of non-nested aggregation expressions"
36+
):
3537
df.agg(col("x").last_value())
3638

3739

3840
def test_last_value_standalone_rejected_in_global_agg():
3941
df = daft.from_pydict({"x": [1, 2, 3]})
40-
with pytest.raises(DaftCoreException, match="Expressions in aggregations must be composed of non-nested aggregation expressions"):
42+
with pytest.raises(
43+
DaftCoreException, match="Expressions in aggregations must be composed of non-nested aggregation expressions"
44+
):
4145
df.agg(last_value(col("x")))
4246

4347

4448
def test_first_value_rejected_in_global_agg():
4549
df = daft.from_pydict({"x": [1, 2, 3]})
46-
with pytest.raises(DaftCoreException, match="Expressions in aggregations must be composed of non-nested aggregation expressions"):
50+
with pytest.raises(
51+
DaftCoreException, match="Expressions in aggregations must be composed of non-nested aggregation expressions"
52+
):
4753
df.agg(col("x").first_value())
4854

4955

5056
def test_first_value_standalone_rejected_in_global_agg():
5157
df = daft.from_pydict({"x": [1, 2, 3]})
52-
with pytest.raises(DaftCoreException, match="Expressions in aggregations must be composed of non-nested aggregation expressions"):
58+
with pytest.raises(
59+
DaftCoreException, match="Expressions in aggregations must be composed of non-nested aggregation expressions"
60+
):
5361
df.agg(first_value(col("x")))
5462

5563

5664
def test_last_value_rejected_in_groupby_agg():
5765
df = daft.from_pydict({"x": [1, 2, 3], "g": ["a", "b", "a"]})
58-
with pytest.raises(DaftCoreException, match="Expressions in aggregations must be composed of non-nested aggregation expressions"):
66+
with pytest.raises(
67+
DaftCoreException, match="Expressions in aggregations must be composed of non-nested aggregation expressions"
68+
):
5969
df.groupby("g").agg(col("x").last_value())
6070

6171

6272
def test_last_value_standalone_rejected_in_groupby_agg():
6373
df = daft.from_pydict({"x": [1, 2, 3], "g": ["a", "b", "a"]})
64-
with pytest.raises(DaftCoreException, match="Expressions in aggregations must be composed of non-nested aggregation expressions"):
74+
with pytest.raises(
75+
DaftCoreException, match="Expressions in aggregations must be composed of non-nested aggregation expressions"
76+
):
6577
df.groupby("g").agg(last_value(col("x")))
6678

6779

6880
def test_first_value_rejected_in_groupby_agg():
6981
df = daft.from_pydict({"x": [1, 2, 3], "g": ["a", "b", "a"]})
70-
with pytest.raises(DaftCoreException, match="Expressions in aggregations must be composed of non-nested aggregation expressions"):
82+
with pytest.raises(
83+
DaftCoreException, match="Expressions in aggregations must be composed of non-nested aggregation expressions"
84+
):
7185
df.groupby("g").agg(col("x").first_value())
7286

7387

7488
def test_first_value_standalone_rejected_in_groupby_agg():
7589
df = daft.from_pydict({"x": [1, 2, 3], "g": ["a", "b", "a"]})
76-
with pytest.raises(DaftCoreException, match="Expressions in aggregations must be composed of non-nested aggregation expressions"):
90+
with pytest.raises(
91+
DaftCoreException, match="Expressions in aggregations must be composed of non-nested aggregation expressions"
92+
):
7793
df.groupby("g").agg(first_value(col("x")))
7894

7995

0 commit comments

Comments
 (0)