Skip to content

Commit 6e51493

Browse files
committed
fix(postgres): make null handling in array concat consistent with all other backends
1 parent d4d4bcc commit 6e51493

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ibis/backends/sql/compilers/postgres.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,12 @@ def visit_StringConcat(self, op, *, arg):
313313
return reduce(lambda x, y: sge.DPipe(this=x, expression=y), arg)
314314

315315
def visit_ArrayConcat(self, op, *, arg):
316-
return reduce(self.f.array_cat, map(partial(self.cast, to=op.dtype), arg))
316+
return reduce(
317+
lambda x, y: self.if_(
318+
x.is_(NULL).or_(y.is_(NULL)), NULL, self.f.array_cat(x, y)
319+
),
320+
map(partial(self.cast, to=op.dtype), arg),
321+
)
317322

318323
def visit_ArrayContains(self, op, *, arg, other):
319324
arg_dtype = op.arg.dtype

0 commit comments

Comments
 (0)