Skip to content

Conversation

@dharanad
Copy link
Contributor

@dharanad dharanad commented Jul 23, 2024

Which issue does this PR close?

Closes #11438

Rationale for this change

What changes are included in this PR?

  • Added a check for uniqueness of named struct fields
  • add sql logic tests

Are these changes tested?

Tested manually


> select {'A': 1, 'a': 2};
+-----------------------------------------------------+
| named_struct(Utf8("A"),Int64(1),Utf8("a"),Int64(2)) |
+-----------------------------------------------------+
| {A: 1, a: 2}                                        |
+-----------------------------------------------------+
1 row(s) fetched. 
Elapsed 0.007 seconds.


> select {'a': 1, 'b': 2, 'c': 3, 'b': 4};
Execution error: named_struct requires unique field names. Field b is used more than once.

& existing test cases.

Are there any user-facing changes?

@dharanad
Copy link
Contributor Author

Based on my understanding, since both struct field names and dictionary keys are of type Ident, it seems challenging to distinguish between a NULL value and a 'NULL' string. Folks any any potential workarounds or alternative approaches that might address this issue?

@github-actions github-actions bot added the sqllogictest SQL Logic Tests (.slt) label Jul 23, 2024
@dharanad dharanad marked this pull request as ready for review July 23, 2024 11:41
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.

Makes sense to me @dharanad -- thank you 🙏

@dharanad dharanad requested a review from alamb July 24, 2024 06:10
@alamb alamb merged commit 6efdbe6 into apache:main Jul 24, 2024
@alamb
Copy link
Contributor

alamb commented Jul 24, 2024

Thanks again @dharanad

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

Labels

sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The struct value should not have duplicate and null name

2 participants