Skip to content

Commit

Permalink
fix(datafusion): handle array concat like everything else
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Nov 5, 2024
1 parent 6e51493 commit f6b4ca4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ibis/backends/sql/compilers/datafusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import calendar
import math
from functools import partial
from functools import partial, reduce
from itertools import starmap

import sqlglot as sg
Expand Down Expand Up @@ -533,5 +533,13 @@ def visit_ArrayFlatten(self, op, *, arg):
def visit_RandomUUID(self, op):
return self.f.anon.uuid()

def visit_ArrayConcat(self, op, *, arg):
return reduce(
lambda x, y: self.if_(
x.is_(NULL).or_(y.is_(NULL)), NULL, self.f.array_cat(x, y)
),
map(partial(self.cast, to=op.dtype), arg),
)


compiler = DataFusionCompiler()

0 comments on commit f6b4ca4

Please sign in to comment.