(Branch 0.9) AST transformations for DISTINCT aggregates

Testing this out. There might be a missing edge case lurking