Skip to content

Commit

Permalink
feat(mssql): implement ops.ExtractEpochSeconds
Browse files Browse the repository at this point in the history
  • Loading branch information
krzysztof-kwitt authored and cpcloud committed Dec 28, 2022
1 parent 4125593 commit 4f49b5b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions ibis/backends/mssql/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,5 +142,11 @@ def _round(t, op):
ops.DayOfWeekIndex: fixed_arity(
lambda x: sa.func.datepart(sa.text('weekday'), x) - 1, 1
),
ops.ExtractEpochSeconds: fixed_arity(
lambda x: sa.cast(
sa.func.datediff(sa.text('s'), '1970-01-01 00:00:00', x), sa.BIGINT
),
1,
),
}
)
2 changes: 1 addition & 1 deletion ibis/backends/tests/test_temporal.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def test_timestamp_extract_milliseconds(backend, alltypes, df):
backend.assert_series_equal(result, expected)


@pytest.mark.notimpl(["datafusion", "mssql"])
@pytest.mark.notimpl(["datafusion"])
def test_timestamp_extract_epoch_seconds(backend, alltypes, df):
expr = alltypes.timestamp_col.epoch_seconds().name('tmp')
result = expr.execute()
Expand Down

0 comments on commit 4f49b5b

Please sign in to comment.