-
Notifications
You must be signed in to change notification settings - Fork 185
facetReindex #1057
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
Closed
Closed
facetReindex #1057
Conversation
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
a3075a7
to
78a5708
Compare
All transforms are now compatible with facet reindexing & planning. Supported transforms:
Not applicable:
|
|
…ing unused facet indices and expanded indices…
…offset with reindexed facets
e2a5d1f
to
aee4469
Compare
too much code! superseded by #1068. |
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.
In some transforms we want to reindex the facets, because of overlapping indices. The typical case is the stack transform, where an element that is present in two facets could be stacked to a certain y position in facet 0, and a different y position in facet 1. To be able to store that information in a flat array structure, we need to "reindex", ie. give each of the data points a deduplicated index across facets. This means that, starting from n elements, we might generate a new y channel that has (up to) n*m elements, where m is the number of facets. The transform leaves us with channels of length n, and other channels of length between n+1 and n * m, which we need to reconcile.
Previously, I thought we'd need to "expand" the shorter channels, that is, copy all their values as many times as necessary to cover all the reindexed pointers. But this proved difficult as the transform doesn't know what those channels are. Also, memory hog.
However, it seems we can do the opposite: "shorten" the long channels and go back to the original facet index. (This allows to keep the short ones unchanged.) The catch is that we're only allowed to do this in places where we don't need the full range of values anymore.
In particular, when we reach the rendering stage, we're inside a facet, and from each "long" channel we can create a "shortened" channel to pass to mark.filter() + mark+render(). Short channels will be left unchanged.
To make this fully work, all intermediary transforms that read values will have to be careful about "reindexed facets". This is a TODO, but it should be possible to abstract this by changing any function that does
i => X[i]
into (pseudocode)(X is a short channel and facet.reindex) ? (i => X[facet.reindex(i)]) : (i => X[i]) .
Alternative to #1041