Skip to content

Commit

Permalink
feat(druid): implement ops.StringJoin
Browse files Browse the repository at this point in the history
  • Loading branch information
krzysztof-kwitt authored and cpcloud committed Mar 13, 2023
1 parent 35f52cc commit 42cd9a3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 8 additions & 0 deletions ibis/backends/druid/registry.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import sqlalchemy as sa
import toolz

import ibis.expr.operations as ops
from ibis.backends.base.sql.alchemy import (
Expand All @@ -22,6 +23,12 @@ def _sign(t, op):
return t.translate(cond2)


def _join(t, op):
sep = t.translate(op.sep)
values = list(map(t.translate, op.arg))
return sa.func.concat(*toolz.interpose(sep, values))


operation_registry.update(
{
ops.BitwiseAnd: fixed_arity(sa.func.bitwise_and, 2),
Expand All @@ -35,5 +42,6 @@ def _sign(t, op):
ops.Power: fixed_arity(sa.func.power, 2),
ops.Log10: fixed_arity(sa.func.log10, 1),
ops.Sign: _sign,
ops.StringJoin: _join,
}
)
1 change: 0 additions & 1 deletion ibis/backends/tests/test_string.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,6 @@ def test_string_col_is_unicode(alltypes, df):
pytest.mark.notimpl(
["datafusion"], raises=com.OperationNotDefinedError
),
pytest.mark.broken(["druid"], raises=sa.exc.ProgrammingError),
],
),
param(
Expand Down

0 comments on commit 42cd9a3

Please sign in to comment.