Skip to content

Commit b643544

Browse files
committed
fix(clickhouse): cast repeat times argument to UInt64
1 parent 84f701c commit b643544

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

ibis/backends/clickhouse/registry.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,13 @@ def _nth_value(translator, expr):
692692
return f"nth_value({arg}, ({nth}) + 1)"
693693

694694

695+
def _repeat(translator, expr):
696+
op = expr.op()
697+
arg = translator.translate(op.arg)
698+
times = translator.translate(op.times)
699+
return f"repeat({arg}, CAST({times} AS UInt64))"
700+
701+
695702
# TODO: clickhouse uses different string functions
696703
# for ascii and utf-8 encodings,
697704

@@ -789,7 +796,7 @@ def _nth_value(translator, expr):
789796
ops.LStrip: _unary('trimLeft'),
790797
ops.RStrip: _unary('trimRight'),
791798
ops.Strip: _unary('trimBoth'),
792-
ops.Repeat: _fixed_arity("repeat", 2),
799+
ops.Repeat: _repeat,
793800
ops.StringConcat: _string_concat,
794801
ops.RegexSearch: _fixed_arity('match', 2),
795802
ops.RegexExtract: _regex_extract,

0 commit comments

Comments
 (0)