izveigor commented on code in PR #7044:
URL: https://github.com/apache/arrow-datafusion/pull/7044#discussion_r1269908881
##########
datafusion/expr/src/logical_plan/plan.rs:
##########
@@ -1753,6 +1754,23 @@ pub enum Partitioning {
}
/// Unnest a column that contains a nested list type.
+///
+/// For example, calling unnest(c1) results in the following:
Review Comment:
From the point of view of all our reference databases, this output is
incorrect:
PostgreSQL:
```
postgres=# select * from unnest_example;
c1 | c2
-------+----
{1,2} | A
| B
{} | D
{3} | E
(4 rows)
postgres=# select unnest(c1), c2 from unnest_example;
unnest | c2
--------+----
1 | A
2 | A
3 | E
(3 rows)
```
DuckDB:
```
D select * from unnest_example;
┌─────────┬─────────┐
│ c1 │ c2 │
│ int32[] │ varchar │
├─────────┼─────────┤
│ [1, 2] │ A │
│ │ B │
│ [] │ D │
│ [3] │ E │
└─────────┴─────────┘
D select unnest(c1), c2 from unnest_example;
┌────────────┬─────────┐
│ unnest(c1) │ c2 │
│ int32 │ varchar │
├────────────┼─────────┤
│ 1 │ A │
│ 2 │ A │
│ 3 │ E │
└────────────┴─────────┘
```
ClickHouse:
```
SELECT *
FROM unnest_example
Query id: be77ac76-c0ee-454a-968c-fa07afcf732d
┌─c1────┬─c2─┐
│ [] │ B │
│ [] │ D │
│ [1,2] │ A │
│ [3] │ E │
└───────┴────┘
4 rows in set. Elapsed: 0.001 sec.
DESKTOP-HM8OC4I. :) select arrayJoin(c1), c2 from unnest_example;
SELECT
arrayJoin(c1),
c2
FROM unnest_example
Query id: 3b8d0451-54f5-4a9a-8938-5505fe75a9df
┌─arrayJoin(c1)─┬─c2─┐
│ 1 │ A │
│ 2 │ A │
│ 3 │ E │
└───────────────┴────┘
3 rows in set. Elapsed: 0.001 sec.
```
##########
datafusion/expr/src/logical_plan/plan.rs:
##########
@@ -1753,6 +1754,23 @@ pub enum Partitioning {
}
/// Unnest a column that contains a nested list type.
+///
+/// For example, calling unnest(c1) results in the following:
Review Comment:
From the point of view of all our reference databases, this output is
incorrect:
PostgreSQL:
```
postgres=# select * from unnest_example;
c1 | c2
-------+----
{1,2} | A
| B
{} | D
{3} | E
(4 rows)
postgres=# select unnest(c1), c2 from unnest_example;
unnest | c2
--------+----
1 | A
2 | A
3 | E
(3 rows)
```
DuckDB:
```
D select * from unnest_example;
┌─────────┬─────────┐
│ c1 │ c2 │
│ int32[] │ varchar │
├─────────┼─────────┤
│ [1, 2] │ A │
│ │ B │
│ [] │ D │
│ [3] │ E │
└─────────┴─────────┘
D select unnest(c1), c2 from unnest_example;
┌────────────┬─────────┐
│ unnest(c1) │ c2 │
│ int32 │ varchar │
├────────────┼─────────┤
│ 1 │ A │
│ 2 │ A │
│ 3 │ E │
└────────────┴─────────┘
```
ClickHouse:
```
SELECT *
FROM unnest_example
Query id: be77ac76-c0ee-454a-968c-fa07afcf732d
┌─c1────┬─c2─┐
│ [] │ B │
│ [] │ D │
│ [1,2] │ A │
│ [3] │ E │
└───────┴────┘
4 rows in set. Elapsed: 0.001 sec.
DESKTOP-HM8OC4I. :) select arrayJoin(c1), c2 from unnest_example;
SELECT
arrayJoin(c1),
c2
FROM unnest_example
Query id: 3b8d0451-54f5-4a9a-8938-5505fe75a9df
┌─arrayJoin(c1)─┬─c2─┐
│ 1 │ A │
│ 2 │ A │
│ 3 │ E │
└───────────────┴────┘
3 rows in set. Elapsed: 0.001 sec.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]