Skip to content

Commit 7fa7395

Browse files
ncclementijcrist
authored andcommitted
refactor(api): make unit required in IntegerValue.as_timestamp
1 parent e6756f3 commit 7fa7395

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

ibis/backends/clickhouse/tests/test_functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ def test_literal_none_to_nullable_column(alltypes):
438438

439439
def test_timestamp_from_integer(con, alltypes, assert_sql):
440440
# timestamp_col has datetime type
441-
expr = alltypes.int_col.as_timestamp()
441+
expr = alltypes.int_col.as_timestamp("s")
442442
assert_sql(expr, "out.sql")
443443
assert len(con.execute(expr))
444444

ibis/backends/impala/tests/test_exprs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def test_builtins(con, alltypes):
5858
i4.as_timestamp("s"),
5959
i4.as_timestamp("ms"),
6060
i4.as_timestamp("us"),
61-
i8.as_timestamp(),
61+
i8.as_timestamp("s"),
6262
d.abs(),
6363
d.cast("decimal(12, 2)"),
6464
d.cast("int32"),
@@ -193,7 +193,7 @@ def test_column_types(alltypes_df, col, expected):
193193
[
194194
(L(50000).as_timestamp("s"), pd.to_datetime(50000, unit="s")),
195195
(L(50000).as_timestamp("ms"), pd.to_datetime(50000, unit="ms")),
196-
(L(5 * 10**8).as_timestamp(), pd.to_datetime(5 * 10**8, unit="s")),
196+
(L(5 * 10**8).as_timestamp("s"), pd.to_datetime(5 * 10**8, unit="s")),
197197
(
198198
ibis.timestamp("2009-05-17 12:34:56").truncate("y"),
199199
pd.Timestamp("2009-01-01"),

ibis/backends/impala/tests/test_value_exprs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def test_timestamp_day_of_week(method_name, snapshot):
235235
@pytest.mark.parametrize(
236236
"expr_fn",
237237
[
238-
lambda col: col.as_timestamp(),
238+
lambda col: col.as_timestamp("s"),
239239
lambda col: col.as_timestamp("ms"),
240240
lambda col: col.as_timestamp("us"),
241241
],

ibis/expr/types/numeric.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,7 @@ def histogram(
10161016
class IntegerValue(NumericValue):
10171017
def as_timestamp(
10181018
self,
1019-
unit: Literal["s", "ms", "us"] = "s",
1019+
unit: Literal["s", "ms", "us"],
10201020
) -> ir.TimestampValue:
10211021
"""Convert an integral UNIX timestamp to a timestamp expression.
10221022

0 commit comments

Comments
 (0)