alamb commented on code in PR #19698:
URL: https://github.com/apache/datafusion/pull/19698#discussion_r2672685623


##########
datafusion/sqllogictest/test_files/unnest.slt:
##########
@@ -798,9 +804,13 @@ NULL 1
 query error DataFusion error: Error during planning: Column in SELECT must be 
in GROUP BY or an aggregate function: While expanding wildcard, column 
"nested_unnest_table\.column1" must appear in the GROUP BY clause or must be 
part of an aggregate function, currently only 
"UNNEST\(nested_unnest_table\.column1\)\[c0\]" appears in the SELECT clause 
satisfies this requirement
 select unnest(column1) c1 from nested_unnest_table group by c1.c0;
 
-# TODO: this query should work. see issue: 
https://github.com/apache/datafusion/issues/12794
-query error DataFusion error: Internal error: Assertion failed: 
struct_allowed: unnest on struct can only be applied at the root level of 
select expression
+## Unnest struct with alias - alias is ignored (same as DuckDB behavior)
+## See: https://github.com/apache/datafusion/issues/12794
+query TT?

Review Comment:
   Likewise here, it would be great to test the schema output
   
   ```sql
   describe select unnest(column1) c1 from nested_unnest_table;
   ```



##########
datafusion/sqllogictest/test_files/unnest.slt:
##########
@@ -58,6 +58,12 @@ select unnest(struct(1,2,3));
 ----
 1 2 3
 
+## Basic unnest expression in select struct with alias (alias is ignored for 
struct unnest)
+query III
+select unnest(struct(1,2,3)) as ignored_alias;

Review Comment:
   Can you also please add a test for the output schema. Perhaps using 
`describe`?
   
   Someting like
   ```sql
    describe select unnest(struct(1,2,3));
   
+-------------------------------------------------------------+-----------+-------------+
   | column_name                                                 | data_type | 
is_nullable |
   
+-------------------------------------------------------------+-----------+-------------+
   | __unnest_placeholder(struct(Int64(1),Int64(2),Int64(3))).c0 | Int64     | 
YES         |
   | __unnest_placeholder(struct(Int64(1),Int64(2),Int64(3))).c1 | Int64     | 
YES         |
   | __unnest_placeholder(struct(Int64(1),Int64(2),Int64(3))).c2 | Int64     | 
YES         |
   
+-------------------------------------------------------------+-----------+-------------+
   3 row(s) fetched.
   Elapsed 0.007 seconds.
   ```



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to