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

Fixes structs to handle non-text struct fields. #450

Merged
merged 4 commits into from
Oct 7, 2021
Merged

Conversation

abhikuhikar
Copy link
Contributor

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

@codecov-commenter
Copy link

codecov-commenter commented Sep 29, 2021

Codecov Report

Merging #450 (87fdb5f) into main (6301396) will decrease coverage by 0.01%.
The diff coverage is 90.47%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main     #450      +/-   ##
============================================
- Coverage     82.35%   82.34%   -0.02%     
- Complexity     1394     1399       +5     
============================================
  Files           171      171              
  Lines         10717    10742      +25     
  Branches       1766     1770       +4     
============================================
+ Hits           8826     8845      +19     
- Misses         1350     1355       +5     
- Partials        541      542       +1     
Flag Coverage Δ
CLI 18.18% <ø> (ø)
EXAMPLES 74.85% <ø> (ø)
LANG 84.83% <90.47%> (-0.03%) ⬇️
PTS ∅ <ø> (∅)
TEST_SCRIPT 79.68% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ng/src/org/partiql/lang/eval/EvaluatingCompiler.kt 84.22% <ø> (ø)
lang/src/org/partiql/lang/errors/ErrorCode.kt 84.52% <81.81%> (-0.10%) ⬇️
...ql/lang/eval/visitors/PartiqlAstSanityValidator.kt 84.78% <100.00%> (+4.22%) ⬆️
lang/src/org/partiql/lang/CompilerPipeline.kt 87.50% <0.00%> (-0.88%) ⬇️
...ng/src/org/partiql/lang/util/IonValueExtensions.kt 44.88% <0.00%> (+0.34%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6301396...87fdb5f. Read the comment docs.

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.

I have some minor suggestions to adjust the error message and error location. Also may need a couple more tests with different struct field name types.

Comment on lines 274 to 275
Property.LINE_NUMBER to 1L,
Property.COLUMN_NUMBER to 8L
Copy link
Member

Choose a reason for hiding this comment

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

There's some slight inconsistency with the error location. If the non-text struct field name is caught at compile time (as in the previous two tests), the error points to the field name. Whereas, in this case it points to the start of the struct constructor (L8). I think both cases should be consistent with the error pointing to the problematic struct field name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

metas are not available with the ExprValue once it is evaluated.

Property.COLUMN_NUMBER to 2L
)
)

Copy link
Member

Choose a reason for hiding this comment

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

May want to also add some tests with NULL and MISSING as the struct field name.

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.

Looks good. Only have a couple small nits and an unused file.

@alancai98
Copy link
Member

For future tracking: when the evaluator is to support a permissive typing mode, these fields with a non-string struct key would be ignored. From the spec

Treatment of mistyped attribute names It is possible that an expression a_I that computes an attribute name
results into a non-string, i.e., a value that is not a legitimate attribute name. In such cases, under the permissive mode
the attribute-value pair will be dismissed. Under the type checking mode the query will fail.

@abhikuhikar abhikuhikar requested a review from alancai98 October 6, 2021 23:17
@abhikuhikar abhikuhikar merged commit 0a82f30 into main Oct 7, 2021
@abhikuhikar abhikuhikar deleted the fix-structs branch October 7, 2021 19:42
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.

Prevent structs with non-text struct keys from being created
3 participants