Skip to content

Commit

Permalink
feat(trino): implement ops.StringSplit
Browse files Browse the repository at this point in the history
  • Loading branch information
krzysztof-kwitt authored and cpcloud committed Dec 24, 2022
1 parent 691b39c commit 62d79a6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions ibis/backends/tests/test_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,17 @@ def test_scalar_param(alltypes, df, value, dtype, col):
@pytest.mark.parametrize(
("value", "dtype"),
[
param("2009-01-20", "date", id="string_date"),
param(
"2009-01-20",
"date",
id="string_date",
marks=[
pytest.mark.broken(
["trino"],
reason="generates incorrect SQL for date string values",
)
],
),
param(datetime.date(2009, 1, 20), "date", id="date_date"),
param(datetime.datetime(2009, 1, 20), "date", id="datetime_date"),
],
Expand All @@ -181,7 +191,6 @@ def test_scalar_param(alltypes, df, value, dtype, col):
"impala",
"pyspark",
"mssql",
"trino",
]
)
def test_scalar_param_date(backend, alltypes, value, dtype):
Expand Down
1 change: 0 additions & 1 deletion ibis/backends/tests/test_string.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,6 @@ def test_string_col_is_unicode(alltypes, df):
"sqlite",
"snowflake",
"mssql",
"trino",
]
),
),
Expand Down
1 change: 1 addition & 0 deletions ibis/backends/trino/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def _string_right(t, op):
ops.Translate: fixed_arity(sa.func.translate, 3),
ops.Capitalize: _capitalize,
ops.StrRight: _string_right,
ops.StringSplit: fixed_arity(sa.func.split, 2),
ops.Repeat: fixed_arity(
lambda value, count: sa.func.array_join(sa.func.repeat(value, count), ''), 2
),
Expand Down

0 comments on commit 62d79a6

Please sign in to comment.