Skip to content

Commit

Permalink
chore(deps): bump polars to 0.20.20 (#8960)
Browse files Browse the repository at this point in the history
Bump polars to 0.20.20 to pick up some changes that allow more `.sql` expressions to work.
  • Loading branch information
cpcloud authored Apr 14, 2024
1 parent 2b7f7b1 commit ab144b5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 26 deletions.
7 changes: 5 additions & 2 deletions ibis/backends/polars/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ def temporal_truncate(op, **kw):
arg = translate(op.arg, **kw)
unit = "mo" if op.unit.short == "M" else op.unit.short
unit = f"1{unit.lower()}"
return arg.dt.truncate(unit, "-1w")
return arg.dt.truncate(unit).dt.offset_by("-1w")


def _compile_literal_interval(op):
Expand All @@ -879,7 +879,9 @@ def timestamp_bucket(op, **kw):
arg = arg.dt.offset_by(neg_offset)
else:
offset = None
res = arg.dt.truncate(interval, offset)
res = arg.dt.truncate(interval)
if offset is not None:
res = res.dt.offset_by(offset)
return res


Expand Down Expand Up @@ -1226,6 +1228,7 @@ def execute_arg_min(op, **kw):

@translate.register(ops.SQLStringView)
def execute_sql_string_view(op, *, ctx: pl.SQLContext, **kw):
translate(op.child, ctx=ctx, **kw)
return ctx.execute(op.query)


Expand Down
20 changes: 4 additions & 16 deletions ibis/backends/tests/test_dot_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,6 @@ def test_con_dot_sql(backend, con, schema):
backend.assert_series_equal(result.astype(expected.dtype), expected)


@pytest.mark.notyet(
["polars"],
raises=PolarsComputeError,
reason="polars doesn't support quoted identifiers referencing CTEs",
)
@pytest.mark.notyet(
["bigquery"], raises=GoogleBadRequest, reason="requires a qualified name"
)
Expand Down Expand Up @@ -123,10 +118,11 @@ def test_table_dot_sql(backend):
assert pytest.approx(result) == expected


@dot_sql_never
@pytest.mark.notyet(
["polars"],
raises=PolarsComputeError,
reason="polars doesn't support quoted identifiers referencing CTEs",
reason="polars doesn't support aliased tables",
)
@pytest.mark.notyet(
["bigquery"], raises=GoogleBadRequest, reason="requires a qualified name"
Expand All @@ -139,7 +135,6 @@ def test_table_dot_sql(backend):
OracleDatabaseError,
reason="oracle doesn't know which of the tables in the join to sort from",
)
@dot_sql_never
def test_table_dot_sql_with_join(backend):
alltypes = backend.functional_alltypes
t = (
Expand All @@ -152,7 +147,7 @@ def test_table_dot_sql_with_join(backend):
""",
dialect="duckdb",
)
.alias("ft")
.alias("ft2")
.group_by("s") # group by a column from SQL
.aggregate(fancy_af=lambda t: t.new_col.mean())
.alias("awesome_t") # create a name for the aggregate
Expand All @@ -162,7 +157,7 @@ def test_table_dot_sql_with_join(backend):
"l"."fancy_af" AS "yas",
"r"."s" AS "s"
FROM "awesome_t" AS "l"
LEFT JOIN "ft" AS "r"
LEFT JOIN "ft2" AS "r"
ON "l"."s" = "r"."s"
""", # clickhouse needs the r.s AS s, otherwise the column name is returned as r.s
dialect="duckdb",
Expand All @@ -185,7 +180,6 @@ def test_table_dot_sql_with_join(backend):
backend.assert_frame_equal(result, expected)


@pytest.mark.notyet(["polars"], raises=PolarsComputeError)
@pytest.mark.notyet(["druid"], reason="druid doesn't respect column name case")
@pytest.mark.notyet(
["bigquery"], raises=GoogleBadRequest, reason="requires a qualified name"
Expand Down Expand Up @@ -242,7 +236,6 @@ def test_dot_sql_reuse_alias_with_different_types(backend, alltypes, df):


@pytest.mark.parametrize("dialect", dialects)
@pytest.mark.notyet(["polars"], raises=PolarsComputeError)
@dot_sql_never
@pytest.mark.notyet(["druid"], reason="druid doesn't respect column name case")
def test_table_dot_sql_transpile(backend, alltypes, dialect, df):
Expand Down Expand Up @@ -323,11 +316,6 @@ def mem_t(con):


@dot_sql_never
@pytest.mark.notyet(
["polars"],
raises=PolarsComputeError,
reason="polars doesn't support selecting from quoted identifiers referencing CTEs",
)
@pytest.mark.notyet(
["druid"],
raises=KeyError,
Expand Down
14 changes: 7 additions & 7 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ poetry-core==1.9.0 ; python_version >= "3.9" and python_version < "4.0"
poetry-dynamic-versioning==1.2.0 ; python_version >= "3.9" and python_version < "4.0"
poetry-plugin-export==1.7.1 ; python_version >= "3.9" and python_version < "4.0"
poetry==1.8.2 ; python_version >= "3.9" and python_version < "4.0"
polars==0.20.19 ; python_version >= "3.9" and python_version < "4.0"
polars==0.20.20 ; python_version >= "3.9" and python_version < "4.0"
pprintpp==0.4.0 ; python_version >= "3.9" and python_version < "4.0"
pre-commit==3.7.0 ; python_version >= "3.9" and python_version < "4.0"
prompt-toolkit==3.0.43 ; python_version >= "3.9" and python_version < "4.0"
Expand Down

0 comments on commit ab144b5

Please sign in to comment.