apache/tajo — pull request #136 by blrunner (2014-09-11 06:32:11+00:00)
Title: TAJO-1010: Improve multiple DISTINCT aggregation. (hyoungjun, jaehwa)

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.