Skip to content

Commit

Permalink
fix(base-sql): fix String-generating backend string concat implementa…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
cpcloud committed Jul 31, 2022
1 parent 48d5058 commit 3cf78c1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ibis/backends/base/sql/registry/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,11 @@ def hash(translator, expr):
raise NotImplementedError(how)


def concat(translator, expr):
joined_args = ', '.join(map(translator.translate, expr.op().arg))
return f"concat({joined_args})"


binary_infix_ops = {
# Binary operations
ops.Add: binary_infix.binary_infix_op('+'),
Expand Down Expand Up @@ -304,7 +309,7 @@ def hash(translator, expr):
ops.Count: aggregate.reduction('count'),
ops.CountDistinct: aggregate.count_distinct,
# string operations
ops.StringConcat: fixed_arity('concat', 2),
ops.StringConcat: concat,
ops.StringLength: unary('length'),
ops.StringAscii: unary('ascii'),
ops.Lowercase: unary('lower'),
Expand Down

0 comments on commit 3cf78c1

Please sign in to comment.