From d4bcf7b04838be3d86064fbc39999c4bf0d1d6b2 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Thu, 21 Dec 2023 05:47:05 -0500 Subject: [PATCH] feat(impala): rudimentary date support --- ibis/backends/base/sql/registry/helpers.py | 1 + ibis/backends/tests/test_param.py | 1 - ibis/backends/tests/test_temporal.py | 17 +---------------- 3 files changed, 2 insertions(+), 17 deletions(-) diff --git a/ibis/backends/base/sql/registry/helpers.py b/ibis/backends/base/sql/registry/helpers.py index 16de96728d19..ed5b4fa170b9 100644 --- a/ibis/backends/base/sql/registry/helpers.py +++ b/ibis/backends/base/sql/registry/helpers.py @@ -67,6 +67,7 @@ def needs_parens(op: ops.Node): "boolean": "boolean", "timestamp": "timestamp", "decimal": "decimal", + "date": "date", } diff --git a/ibis/backends/tests/test_param.py b/ibis/backends/tests/test_param.py index 7a15de8e0cff..36d2ee89c43d 100644 --- a/ibis/backends/tests/test_param.py +++ b/ibis/backends/tests/test_param.py @@ -204,7 +204,6 @@ def test_scalar_param(backend, alltypes, df, value, dtype, col): ids=["string", "date", "datetime"], ) @pytest.mark.notimpl(["druid", "oracle"]) -@pytest.mark.notyet(["impala"], reason="impala doesn't support dates") def test_scalar_param_date(backend, alltypes, value): param = ibis.param("date") ds_col = alltypes.date_string_col diff --git a/ibis/backends/tests/test_temporal.py b/ibis/backends/tests/test_temporal.py index 4eed80ce057d..7d2648acc0e4 100644 --- a/ibis/backends/tests/test_temporal.py +++ b/ibis/backends/tests/test_temporal.py @@ -81,14 +81,7 @@ @pytest.mark.parametrize("attr", ["year", "month", "day"]) @pytest.mark.parametrize( "expr_fn", - [ - param(lambda c: c.date(), id="date"), - param( - lambda c: c.cast("date"), - id="cast", - marks=pytest.mark.notimpl(["impala"], raises=com.UnsupportedBackendType), - ), - ], + [param(lambda c: c.date(), id="date"), param(lambda c: c.cast("date"), id="cast")], ) @pytest.mark.notimpl( ["druid"], @@ -1957,7 +1950,6 @@ def test_string_to_timestamp(alltypes, fmt): ], ) @pytest.mark.notimpl(["mssql", "druid", "oracle"], raises=com.OperationNotDefinedError) -@pytest.mark.notimpl(["impala"], raises=com.UnsupportedBackendType) @pytest.mark.notimpl( ["flink"], raises=Py4JJavaError, @@ -2494,7 +2486,6 @@ def test_timestamp_column_from_ymdhms(backend, con, alltypes, df): "java.lang.UnsupportedOperationException: class org.apache.calcite.sql.SqlIdentifier: LONG" ), ) -@pytest.mark.notimpl(["impala"], raises=com.UnsupportedBackendType) @pytest.mark.notimpl( ["oracle"], raises=sa.exc.DatabaseError, reason="ORA-01861 literal does not match" ) @@ -2512,7 +2503,6 @@ def test_date_scalar_from_iso(con): raises=sa.exc.ProgrammingError, reason="java.lang.UnsupportedOperationException: class org.apache.calcite.sql.SqlIdentifier: STRING", ) -@pytest.mark.notimpl(["impala"], raises=com.UnsupportedBackendType) @pytest.mark.notyet( ["oracle"], raises=sa.exc.DatabaseError, @@ -2648,11 +2638,6 @@ def build_date_col(t): raises=sa.exc.CompileError, reason='No literal value renderer is available for literal value "datetime.date(2010, 11, 1)" with datatype DATE', ) -@pytest.mark.notyet( - ["impala"], - reason="impala doesn't support dates", - raises=com.UnsupportedBackendType, -) @pytest.mark.notimpl(["oracle"], raises=sa.exc.DatabaseError) @pytest.mark.parametrize( ("left_fn", "right_fn"),