Add support for explicit sparse lists and maps#599
Merged
Conversation
mtdowling
commented
Oct 8, 2020
kstich
requested changes
Oct 9, 2020
cc280fa to
c831eb2
Compare
kstich
approved these changes
Oct 12, 2020
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.
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
This file contains hidden or 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
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
sparsetrait. 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.