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

Map access supports constant-resolvable expressions #14712

Merged
merged 3 commits into from
Feb 20, 2025

Conversation

Lordworms
Copy link
Contributor

@Lordworms Lordworms commented Feb 17, 2025

Which issue does this PR close?

Rationale for this change

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions bot added sqllogictest SQL Logic Tests (.slt) functions labels Feb 17, 2025
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 @Lordworms -- this looks great and very close

I think it just needs a few more negative tests

cc @goldmedal

@@ -592,6 +592,24 @@ select map_extract(column1, 1), map_extract(column1, 5), map_extract(column1, 7)
[NULL] [NULL] [[1, NULL, 3]]
[NULL] [NULL] [NULL]

query ?
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you also please add some error tests for out of bounds access. For example, column[0], column[-1] and column[1000] to test the boundary condidtions?

Also, it seems like the code in this PR supports queries like

select column1[column2]

where column2 is an array of integer as well

Can you also add a test for that syntax as well?

.slice(start, end - start)
.iter()
.enumerate()
.find(|(_, t)| t.unwrap());
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand why this panic is never called, but then I see you just moved the code

@alamb
Copy link
Contributor

alamb commented Feb 17, 2025

Also FYI @findepi

@Lordworms Lordworms force-pushed the issue_14552 branch 2 times, most recently from acd81e7 to 92174c1 Compare February 17, 2025 21:55
fix clippy

fix clippy

fix clippy
@findepi
Copy link
Member

findepi commented Feb 18, 2025

thanks for your PR!

What are "constant-resolvable expressions"?
If this is "effectively constant", then we should not close #14552 yet.

@Lordworms
Copy link
Contributor Author

thanks for your PR!

What are "constant-resolvable expressions"? If this is "effectively constant", then we should not close #14552 yet.

I should change the title, primitive and part of the nested types(array, struct, list) are supported now

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 @Lordworms and @findepi -- looks good to me

@alamb alamb merged commit 310eab0 into apache:main Feb 20, 2025
26 checks passed
@alamb
Copy link
Contributor

alamb commented Feb 20, 2025

For soem reason this PR caused a logical / build conflict

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.

Access a Map with a non-string keys
3 participants