-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Allow selecting multiple aggregate columns #3
Comments
@aturon @nikomatsakis Was thinking about this recently, and thought you might be interested as it would have been helped by the lattice rule, but could be aided by other additions to the type system as well. Basically we have an impl that looks like this for every size tuple: impl<T, U> Expression for (T, U) where
T: Expression + NonAggregate,
U: Expression + NonAggregate,
{
// ...
} What we need is to write something along the lines of: impl<T, U> Expression for (T, U) where
T: Expression + !NonAggregate,
U: Expression + !NonAggregate,
{
// ...
} With the lattice rule we could have added an The main goal (in case there's another solution that I'm missing) is to make sure that we do not have an impl for |
Also I know you had asked me to keep you in the loop when I find some concrete examples to point you guys at. Is there a preferred form of communication besides just pinging you on issues like this? |
@sgrif this seems good. The hard part I guess might be finding these examples later -- I'll try to keep a log. For what it's worth, this would probably be addressed by the semi-proposal for negative reasoning I advanced in this comment, which itself is just a variant on rust-lang/rfcs#1148. |
@sgrif Thanks for the heads up! In general issue comments like this are fine -- perhaps you could have a meta-issue with links to various examples as they come up, just so there's ultimately one place to track? |
This problem could possibly be solved by using a |
When supporting multiple aggregate columns we should consider that there could be queries that mix aggregate and non-aggregate fields. See for example the following query: SELECT a.id, count(b::id) FROM a LEFT JOIN b ON a.id = b.a_id GROUP BY a.id; |
Closed by #2251 |
I had hoped that this would just involve adding an
Aggregate
marker trait, and modifying the tuple impls to allow if all members are aggregate. This causes overlap since any type could implement bothNonAggregate
andAggregate
. I do not think there is a way to express this currently in the type system currently, without negative bounds (or maybe specialization)The text was updated successfully, but these errors were encountered: