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

Addresses some conformance edge cases #1539

Merged
merged 6 commits into from
Aug 15, 2024
Merged

Conversation

johnedquinn
Copy link
Member

@johnedquinn johnedquinn commented Aug 7, 2024

Description

  • This PR addresses some small bugs that are fairly self explanatory.
  • The only meaningful change has to do with Section 6.1.1.1 Tuple Constructors (Mistyping Cases):

In the permissive mode, the query:

SELECT VALUE {v.a: v.b}
FROM [{'a':'legit', 'b':1}, {'a':400, 'b':2}] AS v

results into

<<{'legit':1}, {}>>

Notice that the attempt to create an attribute named 400 failed, thus leading to a tuple with no attributes.

Other Information

License Information

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@johnedquinn johnedquinn force-pushed the v1-fix-tests branch 5 times, most recently from c402e10 to 0c657d9 Compare August 8, 2024 21:58
@johnedquinn johnedquinn changed the title [DRAFT] Fixes V1 Tests Addresses some conformance edge cases Aug 8, 2024
@johnedquinn johnedquinn marked this pull request as ready for review August 8, 2024 22:04
@johnedquinn johnedquinn requested a review from alancai98 August 9, 2024 16:56
Copy link
Member

@alancai98 alancai98 left a comment

Choose a reason for hiding this comment

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

one followup comment for a struct constructor edge case. otherwise looks good

val fields = fields.mapNotNull {
val key = it.key.eval(env)
if (key.isNull) {
return Datum.nullValue()
Copy link
Member

Choose a reason for hiding this comment

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

Why is null returned for the overall struct constructor expression if one key is null? For the following query,

SELECT VALUE {v.a: v.b} FROM [{'a':'legit', 'b':1}, {'a':null, 'b':2}] AS v

<< { legit: 1 }, null >> will currently be the output.

My read of the "Treatment of mistyped attribute names" section of the PartiQL spec is that null struct key values (alike non-strings and missing values) would just omit that struct field from the struct in permissive mode. Following my read, the above query would result in << { 'legit': 1 }, {} >>.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, nice! From our offline discussion, I've created an issue with the team's consensus on behavior as well as the need for potential clarification in the PartiQL Spec: partiql/partiql-lang#88

I've just updated this PR accordingly. I also needed to rebase off of the type-renaming PR. The last two commits represent what has been updated.

Copy link
Member

@alancai98 alancai98 left a comment

Choose a reason for hiding this comment

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

one followup comment for a struct constructor edge case. otherwise looks good

@johnedquinn johnedquinn merged commit db9b6bd into partiql:v1 Aug 15, 2024
7 checks passed
@johnedquinn johnedquinn deleted the v1-fix-tests branch August 15, 2024 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants