Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DuckDB struct test and row as alias #12841

Merged
merged 3 commits into from
Oct 10, 2024

Conversation

jayzhan211
Copy link
Contributor

Which issue does this PR close?

Closes #.

Rationale for this change

Add support for DuckDB-like syntax and functions to facilitate testing

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

Signed-off-by: jayzhan211 <[email protected]>
@github-actions github-actions bot added sqllogictest SQL Logic Tests (.slt) functions labels Oct 10, 2024
Signed-off-by: jayzhan211 <[email protected]>
@alamb
Copy link
Contributor

alamb commented Oct 10, 2024

wasmtest Ci failure has been fixed in #12844

@jayzhan211 jayzhan211 marked this pull request as ready for review October 10, 2024 14:22
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😍 -- thank you @jayzhan211

# Test row alias

query ?
select row('a', 'b');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW there is pretty sweet struct literal syntax like { c1: 'a', c2: 'b'} as well

> select { c1: 'a', c2: 'b'};
+---------------------------------------------------------+
| named_struct(Utf8("c1"),Utf8("a"),Utf8("c2"),Utf8("b")) |
+---------------------------------------------------------+
| {c1: a, c2: b}                                          |
+---------------------------------------------------------+
1 row(s) fetched.
Elapsed 0.002 seconds.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In DuckDB, they don't have column name. Stored like a tuple.

D select row('red', 1);
┌──────────────────────────┐
│    main.row('red', 1)    │
│ struct(varchar, integer) │
├──────────────────────────┤
│ (red, 1)                 │
└──────────────────────────┘

@jayzhan211 jayzhan211 merged commit 58c32cb into apache:main Oct 10, 2024
24 checks passed
@jayzhan211 jayzhan211 deleted the add-duckb-struct-n-row branch October 10, 2024 23:47
@jayzhan211
Copy link
Contributor Author

Thanks @alamb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
functions sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants