Skip to content

Commit 7b0a506

Browse files
cpcloudkszucs
authored andcommitted
feat(postgres): implement ArrayColumn
1 parent 8c96e3c commit 7b0a506

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

ibis/backends/postgres/registry.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,10 @@ def _day_of_week_name(t, expr):
602602
return sa.func.trim(sa.func.to_char(sa_arg, 'Day'))
603603

604604

605+
def _array_column(t, expr):
606+
return postgresql.array(list(map(t.translate, expr.op().cols)))
607+
608+
605609
operation_registry.update(
606610
{
607611
ops.Literal: _literal,
@@ -676,6 +680,7 @@ def _day_of_week_name(t, expr):
676680
# array operations
677681
ops.ArrayLength: unary(_cardinality),
678682
ops.ArrayCollect: unary(sa.func.array_agg),
683+
ops.ArrayColumn: _array_column,
679684
ops.ArraySlice: _array_slice,
680685
ops.ArrayIndex: fixed_arity(
681686
lambda array, index: array[_neg_idx_to_pos(array, index) + 1], 2

ibis/backends/tests/test_array.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
pytestmark = pytest.mark.never(["sqlite", "mysql"], reason="No array support")
1111

1212

13-
@pytest.mark.notimpl(["impala", "postgres", "clickhouse", "datafusion"])
13+
@pytest.mark.notimpl(["impala", "clickhouse", "datafusion"])
1414
def test_array_column(backend, alltypes, df):
1515
expr = ibis.array([alltypes['double_col'], alltypes['double_col']])
1616
assert isinstance(expr, ir.ArrayColumn)

0 commit comments

Comments
 (0)