AST transformations for DISTINCT aggregates

#### Recap
For queries with DISTINCT aggregates that don’t have a GROUP BY (i.e., the query returns a single number), Shark relies on a single shuffle and reduce for both processing the distincts (using an in-memory sort) and the final aggregation. THis is a pretty severe bottleneck

Queries with GROUP BY aren’t an issue because full aggregation for each key can be done locally on a reducer after a hash-partitioned shuffle.

Note: This type of optimization will be moved to the optimizer level in a future dev cycle. For a preview, check out the Catalyst abstract ([link](http://spark-summit.org/talk/armbrust-catalyst-a-query-optimization-framework-for-spark-and-shark/)) and the corresponding slides ([download link]
(http://spark-summit.org/wp-content/uploads/2013/10/J-Michael-Armburst-catalyst-spark-summit-dec-2013.pptx))

#### Approach
Execution for DISTINCT aggregates (without GROUP BY) should be split into two shuffles: the first to hash-partition selected expressions and the second to rendezvous at a single reducer that will do the final aggregation.

<i> In the diagrams below, the nodes in red are modified and the nodes in blue are moved from the original AST. Nodes in green are directly instantiated in Shark. Nodes not colored remain unchanged. </i>

In the driver, `ASTRewriteUtil#countDistinctToGroupBy()` searches for patterns of the AST representation for
```
SELECT <aggregate fn>(DISTINCT <exprs>) FROM <source> <WHERE, ORDER BY, etc>
```
where `<source>` is a table, subquery, or a table or subquery alias.
![countdistinct 1](https://f.cloud.github.com/assets/1581364/1652614/9d949ede-5b1a-11e3-9770-fe7b7e607f7c.png)

Then, for each subtree that matches the pattern, transform it to the AST representation for the rewriten query, 
```
SELECT <aggregate fn>(*) FROM
   (SELECT DISTINCT <exprs> FROM <source> <WHERE, ORDER BY, etc>) <Shark-internal alias>
```
![countdistinctrewrite 1](https://f.cloud.github.com/assets/1581364/1652616/a2fabd2c-5b1a-11e3-9ccf-7914c54d3c3a.png)