Implement DistinctBy

First part of the fix for #284. This is all the hard work, but leaves the most interesting test
pending because it will require a second sort to be introduced in the compiler. That PR will 
be coming soon.
I see your point. In a way, the synthetic projections are really part of a slightly more constrained query language. But we're expressing them in the AST because we do semantic analysis on the AST, and we need to include them in that analysis. Given that, we've got to somehow keep track of them. The old hack just inspected the names. Is that better, or can you propose something else?