Minor: clean up TODO comments in unnest.slt#12795
Merged
alamb merged 1 commit intoapache:mainfrom Oct 8, 2024
Merged
Conversation
goldmedal
commented
Oct 7, 2024
| 5 | ||
| 6 | ||
|
|
||
| ## FIXME: https://github.com/apache/datafusion/issues/11198 |
Contributor
Author
There was a problem hiding this comment.
This issue has been closed. The error assertion makes sense to me. I also added another positive test at L539
goldmedal
commented
Oct 7, 2024
|
|
||
| ## TODO: support unnest as a child expr | ||
| query error DataFusion error: Internal error: unnest on struct can only be applied at the root level of select expression | ||
| select arrow_typeof(unnest(column5)) from unnest_table; |
Contributor
Author
There was a problem hiding this comment.
This error isn't a child expression issue. It's an issue about applying a function to an unnest struct expression. The error message makes sense to me. DuckDB has similar behavior:
D CREATE TABLE unnest_table
AS VALUES
([1,2,3], [7], 1, [13, 14], {'c1': 1, 'c2': 2}),
([4,5], [8,9,10], 2, [15, 16], {'c1':3,'c2':4}),
([6], [11,12], 3, null, null),
([12], [null, 42, null], null, null, {'c1':7,'c2':8}),
-- null array to verify the `preserve_nulls` option
(null, null, 4, [17, 18], null)
;
D select typeof(unnest(col4)) from unnest_table;
Binder Error: UNNEST() on a struct column can only be applied as the root element of a SELECT expression
LINE 1: select typeof(unnest(col4)) from unnest_table
goldmedal
commented
Oct 7, 2024
Comment on lines
+517
to
+520
| query T | ||
| select arrow_typeof(unnest(column1)) from unnest_table; | ||
| ---- | ||
| Int64 |
Contributor
Author
There was a problem hiding this comment.
Unnest as a child expression works fine if the input isn't a struct.
goldmedal
commented
Oct 7, 2024
|
|
||
| ### TODO: group by unnest struct | ||
| query error DataFusion error: Error during planning: Projection references non\-aggregate values | ||
| select unnest(column1) c1 from nested_unnest_table group by c1.c0; |
Contributor
Author
There was a problem hiding this comment.
Although the error message is weird, asserting that this query fails makes sense to me.
DuckDB doesn't allow this SQL, too. I can't find other databases with this behavior. 🤔
D CREATE TABLE unnest_table
AS VALUES
([1,2,3], [7], 1, [13, 14], {'c1': 1, 'c2': 2}),
([4,5], [8,9,10], 2, [15, 16], {'c1':3,'c2':4}),
([6], [11,12], 3, null, null),
([12], [null, 42, null], null, null, {'c1':7,'c2':8}),
-- null array to verify the `preserve_nulls` option
(null, null, 4, [17, 18], null)
;
D select unnest(col4) u1 from unnest_table group by u1.c1;
Binder Error: Referenced table "u1" not found!
Candidate tables: "unnest_table"
LINE 1: ...st(col4) u1 from unnest_table group by u1.c1;
goldmedal
commented
Oct 7, 2024
Comment on lines
+801
to
+803
| # TODO: this query should work. see issue: https://github.com/apache/datafusion/issues/12794 | ||
| query error DataFusion error: Internal error: unnest on struct can only be applied at the root level of select expression | ||
| select unnest(column1) c1 from nested_unnest_table |
Contributor
|
🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Closes #.
Rationale for this change
What changes are included in this PR?
Remove some legacy TODO comments and refine the tests for unnest.
Are these changes tested?
the original CI
Are there any user-facing changes?
no