-
Notifications
You must be signed in to change notification settings - Fork 219
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
Add support for explicit sparse lists and maps #599
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mtdowling
commented
Oct 8, 2020
kstich
requested changes
Oct 9, 2020
mtdowling
force-pushed
the
add-sparse-lists-and-maps
branch
from
October 12, 2020 19:11
cc280fa
to
c831eb2
Compare
kstich
approved these changes
Oct 12, 2020
kggilmer
approved these changes
Oct 12, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
jasdel
approved these changes
Oct 13, 2020
The vast majority of all lists and maps in use today are dense, meaning they cannot contain null values. However, we have historically had no way to indicate that a list or map (value) supports nulls, so we had to assume that all lists and maps are sparse. This change makes it so that all lists and maps are considered dense by default, but services can opt-in to sparse lists using the `sparse` trait. This matters because it now allows languages that bake "null" into their type systems to provide better generated types. Given that nullability is now more abstract than just the box trait, I think that deprecating BoxIndex in favor of NullableIndex makes the concept more clear. BoxIndex still exists and can be used, but extends from NullableIndex.
mtdowling
force-pushed
the
add-sparse-lists-and-maps
branch
from
October 13, 2020 00:58
059fd3a
to
ac17950
Compare
kstich
reviewed
Oct 13, 2020
smithy-model/src/main/java/software/amazon/smithy/model/knowledge/NullableIndex.java
Show resolved
Hide resolved
smithy-model/src/main/java/software/amazon/smithy/model/knowledge/NullableIndex.java
Show resolved
Hide resolved
kstich
approved these changes
Oct 13, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The vast majority of all lists and maps in use today are dense, meaning
they cannot contain null values. However, we have historically had no
way to indicate that a list or map (value) supports nulls, so we had to
assume that all lists and maps are sparse. This change makes it so that
all lists and maps are considered dense by default, but services can
opt-in to sparse lists using the
sparse
trait. This matters because itnow allows languages that bake "null" into their type systems to provide
better generated types.
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.