-
Notifications
You must be signed in to change notification settings - Fork 185
sort bins #334
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
sort bins #334
Conversation
I prefer the alternative syntax where we sort by the output of the bin/group (most of the time I'm going to want to see biggest / smallest aggregates). |
A complementary approach would be to automatically sort dots by r (if r is a channel), and maybe lineX (on y) and lineY (on x)? |
This is very similar to what I propose for filter! #495 |
f57714f
to
7b21cc1
Compare
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.
Oops, I just realized there’s an issue here. This sort option allows a corresponding sort input so that you can, for example, sort by sum of weights. However, the sort input channel is retained in options and thus is also applied as a basic sort transform prior to the bin and group transform. That seems confusing: either you intended the sort option to be the basic sort transform, or you intended the sort option to be the input to the sort reducer, but not both. We should try to avoid this ambiguity.
Another issue is that sorting is a little different than most reducers: you don’t strictly want to compute an output value; instead you want to define a total order. And hence it’d be nice if you could specify a comparator to the sort output in the same way you can to the basic transform.
I’ll try to work on this tomorrow.
I’m not sure about the comparator issue, but as far as the input channel vs. basic transform ambiguity goes with the sort option, I’m thinking we can resolve that by changing how we interpret the sort option based on the presence or absence of the sort output: if a sort output is specified, then the sort option represents the input channel; but otherwise the sort option is a basic transform that is applied before the bin or group. (And you can always make this explicit using Plot.sort if you like.) This approach could be extended to the filter option in the other PR, too. |
7b21cc1
to
7e66dae
Compare
I am going to merge this into the filter option PR #495 so we can do both simultaneously. |
The proposed syntax specifies sort in the reduce/outputs object, enabling sorting on a different reducer.
closes #297