Skip to content

Add DuckDB struct test and row as alias - #12841

Merged
jayzhan211 merged 3 commits into
apache:mainfrom
jayzhan211:add-duckb-struct-n-row
Oct 10, 2024
Merged

Add DuckDB struct test and row as alias#12841
jayzhan211 merged 3 commits into
apache:mainfrom
jayzhan211:add-duckb-struct-n-row

Conversation

@jayzhan211

Copy link
Copy Markdown
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 <jayzhan211@gmail.com>
@github-actionsgithub-actionsBot added sqllogictest SQL Logic Tests (.slt) functions Changes to functions implementation labels Oct 10, 2024
Signed-off-by: jayzhan211 <jayzhan211@gmail.com>
@alamb

Copy link
Copy Markdown
Contributor

wasmtest Ci failure has been fixed in #12844

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

@alambalamb left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
ContributorAuthor

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:mainOct 10, 2024
@jayzhan211
jayzhan211 deleted the add-duckb-struct-n-row branch October 10, 2024 23:47
@jayzhan211

Copy link
Copy Markdown
ContributorAuthor

Thanks @alamb

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

functionsChanges to functions implementationsqllogictestSQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@jayzhan211@alamb