Skip to content

Commit 12e6931

Browse files
authored
fix: Correct output datatype of dt.year and dt.mil (#23646)
1 parent 572db33 commit 12e6931

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

crates/polars-plan/src/plans/aexpr/function_expr/datetime.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ impl IRTemporalFunction {
8282
pub(super) fn get_field(&self, mapper: FieldsMapper) -> PolarsResult<Field> {
8383
use IRTemporalFunction::*;
8484
match self {
85-
Millennium | Century => mapper.with_dtype(DataType::Int8),
86-
Year | IsoYear => mapper.with_dtype(DataType::Int32),
85+
Millennium | Century | Year | IsoYear => mapper.with_dtype(DataType::Int32),
8786
OrdinalDay => mapper.with_dtype(DataType::Int16),
8887
Month | Quarter | Week | WeekDay | Day | Hour | Minute | Second => {
8988
mapper.with_dtype(DataType::Int8)

py-polars/tests/unit/operations/test_index_of.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ def test_groupby() -> None:
179179
)
180180
# The examples are cases where this test previously caught bugs:
181181
@example([], [], [None])
182+
@pytest.mark.slow
182183
def test_randomized(
183184
list1: list[int | None], list2: list[int | None], list3: list[int | None]
184185
) -> None:

py-polars/tests/unit/sql/test_cast.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ def test_cast_errors(values: Any, cast_op: str, error: str) -> None:
185185
assert None in res.to_series()
186186

187187

188+
@pytest.mark.may_fail_cloud # reason: eager construct to_struct
188189
def test_cast_json() -> None:
189190
df = pl.DataFrame({"txt": ['{"a":[1,2,3],"b":["x","y","z"],"c":5.0}']})
190191

0 commit comments

Comments
 (0)