This repository has been archived by the owner on Oct 28, 2024. It is now read-only.
Add a categorical field type [native values version] #62
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.
Here's a native values version of the categorical proposal, see #48 for a version based on physical/lexical values instead.
Key differences:
If the native format supports categorical data types, the field
MUST
be represented in that native format.The
categories
prop is now optional, because if the native format already supports categorical variables it's not strictly necessary. (But perhaps we want to require it anyway, as it defines the logical type?)When the native format doesn't support categorical types, it can use any native type instead (as suggested by @pschumm). I'm not quite sure about this; I'd be more comfortable if it was just numeric / string types, but can't think of a specific counter-case at the moment.
With native types, the
logical
representation of levels (for constraints) in the spec becomes much harder to pin down, becausecategorical
no longer has a "base" data type (as @roll observed)... the "logical" type may be integer in some implementations, or closer to string in other implementations. I've implemented @pschumm's solution here of just having the constraint definition match the full level definition.I think between this and my updates to #48, I've addressed everyone's comments so far... but please let me know if I've overlooked anything!