Class MeasureRules.AggregateMeasure2Rule

All Implemented Interfaces:
TransformationRule
Enclosing class:
MeasureRules

public static class MeasureRules.AggregateMeasure2Rule extends RelRule<MeasureRules.AggregateMeasure2RuleConfig> implements TransformationRule
Rule that matches an Aggregate with at least one call to SqlInternalOperators.AGG_M2V and expands these calls by asking the measure for its expression.

Converts


 Aggregate(a, b, AGG_M2V(c), SUM(d), AGG_M2V(e))
   R
 

to


 Project(a, b, RexSubQuery(...), sum_d, RexSubQuery(...))
   Aggregate(a, b, SUM(d) AS sum_d)
     R
 

We will optimize those RexSubQuery later. For example,


 SELECT deptno,
     (SELECT AVG(sal)
      FROM emp
      WHERE deptno = e.deptno)
 FROM Emp
 

will become


 SELECT deptno, AVG(sal)
 FROM emp
 WHERE deptno = e.deptno
 
See Also: