File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change 55from itertools import chain
66from typing import TYPE_CHECKING , Any
77
8+ import duckdb
89from duckdb import CoalesceOperator , Expression
910from duckdb .typing import BIGINT , VARCHAR
1011
@@ -86,6 +87,14 @@ def concat(
8687 if how == "vertical" and not all (x .schema == schema for x in items [1 :]):
8788 msg = "inputs should all have the same schema"
8889 raise TypeError (msg )
90+ if how == "diagonal" :
91+ res = first .native
92+ for _item in native_items [1 :]:
93+ # TODO(unassigned): use relational API when available https://github.com/duckdb/duckdb/discussions/16996
94+ res = duckdb .sql ("""
95+ from res select * union all by name from _item select *
96+ """ )
97+ return first ._with_native (res )
8998 res = reduce (lambda x , y : x .union (y ), native_items )
9099 return first ._with_native (res )
91100
Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ def test_concat_vertical(constructor: Constructor) -> None:
6464def test_concat_diagonal (
6565 constructor : Constructor , request : pytest .FixtureRequest
6666) -> None :
67- if "duckdb" in str ( constructor ) or " ibis" in str (constructor ):
67+ if "ibis" in str (constructor ):
6868 request .applymarker (pytest .mark .xfail )
6969 data_1 = {"a" : [1 , 3 ], "b" : [4 , 6 ]}
7070 data_2 = {"a" : [100 , 200 ], "z" : ["x" , "y" ]}
You can’t perform that action at this time.
0 commit comments