apache/tajo — pull request #126 by blrunner (2014-08-26 19:05:54+00:00)
Title: TAJO-1010: Improve multiple DISTINCT aggregation.

Tajo supports various options for count distinct. Current option is to execute a count distinct query with two execution blocks. It made by DistinctGroupbyBuilder::buildPlan. But now, new option is to execute the query with three execution blocks. You can use this option for set SessionVars.COUNT_DISTINCT_ALGORITHM to three_stages.
* In first stage, tajo operator incremented each row to more rows by grouping columns. In addition, the operator must creates each row because of aggregation non-distinct columns.
* In second stage, tajo operator aggregates the output of the first stage. For reference, it shuffled by grouping columns and aggregation columns.
* In third stage, tajo operator merges the output of the second stage. For reference, it shuffled by just grouping columns.

For reference, this patch need to implement empty input data handling function and union with distinct count.