Ashutosh,

You had a question about CountSplitter.singleton and whether it was ever used. 
The short answer is no, it is not currently used.

The purpose of singletons is to optimize say

  SELECT a, min(b), max(b), sum(b), count(b)
  FROM t
  GROUP BY a

to

  SELECT a, b, b, b, CASE WHEN b IS NULL THEN 0 ELSE 1 END
  FROM t
  GROUP BY a

if you know that ‘a' is unique. The only place that currently uses singletons 
is AggregateJoinTransposeRule, in folding partial results, for example in 
computing a count by summing partial counts. COUNT is never used for summing 
partial results (only MIN, MAX, SUM and SUM0).

But we hope to use singletons elsewhere in future, for example an improved 
AggregateRemoveRule. The current version of that rule bails out if the 
aggregate has aggregate functions.

Julian

Reply via email to