From acd3495d624c8d5998a766c97fee5e67844fe91d Mon Sep 17 00:00:00 2001 From: Tyler White <50381805+IndexSeek@users.noreply.github.com> Date: Tue, 31 Dec 2024 13:53:00 +0000 Subject: [PATCH] feat(polars): add TimeFromHMS op --- ibis/backends/polars/compiler.py | 9 +++++++++ ibis/backends/tests/test_temporal.py | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ibis/backends/polars/compiler.py b/ibis/backends/polars/compiler.py index a4b52f03ad35..92f47e717c5f 100644 --- a/ibis/backends/polars/compiler.py +++ b/ibis/backends/polars/compiler.py @@ -1468,6 +1468,15 @@ def execute_timestamp_range(op, **kw): return pl.datetime_ranges(start, stop, f"{step}{unit}", closed="left") +@translate.register(ops.TimeFromHMS) +def execute_time_from_hms(op, **kw): + return pl.time( + hour=translate(op.hours, **kw), + minute=translate(op.minutes, **kw), + second=translate(op.seconds, **kw), + ) + + @translate.register(ops.DropColumns) def execute_drop_columns(op, **kw): parent = translate(op.parent, **kw) diff --git a/ibis/backends/tests/test_temporal.py b/ibis/backends/tests/test_temporal.py index c8f49f17cb31..a5e318724e42 100644 --- a/ibis/backends/tests/test_temporal.py +++ b/ibis/backends/tests/test_temporal.py @@ -1535,7 +1535,7 @@ def test_timestamp_with_timezone_literal(con, timezone, expected): @pytest.mark.notimpl( - ["datafusion", "pyspark", "polars", "mysql", "oracle", "databricks"], + ["datafusion", "pyspark", "mysql", "oracle", "databricks"], raises=com.OperationNotDefinedError, ) @pytest.mark.notyet(