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

Add support for explicit sparse lists and maps #599

Merged
merged 1 commit into from
Oct 13, 2020

Conversation

mtdowling
Copy link
Member

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.

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.

docs/source/1.0/spec/core/constraint-traits.rst Outdated Show resolved Hide resolved
docs/source/1.0/spec/core/model.rst Outdated Show resolved Hide resolved
Copy link
Contributor

@kggilmer kggilmer left a comment

Choose a reason for hiding this comment

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

LGTM

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 mtdowling requested a review from kstich October 13, 2020 17:13
@mtdowling mtdowling merged commit 8c07e24 into master Oct 13, 2020
@mtdowling mtdowling deleted the add-sparse-lists-and-maps branch December 11, 2020 17:59
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.

4 participants