Julian Hyde created CALCITE-5105:
------------------------------------

             Summary: Add MEASURE type and AGGREGATE aggregate function
                 Key: CALCITE-5105
                 URL: https://issues.apache.org/jira/browse/CALCITE-5105
             Project: Calcite
          Issue Type: Bug
            Reporter: Julian Hyde


In CALCITE-4496 we propose adding measures to SQL, and an "AS MEASURE" 
sub-clause to the SELECT clause so that you can define measures. This change is 
a first step in that direction: namely the ability to define the columns are 
measures and use validate queries that use measures.

This change adds a {{MEASURE}} type, which is parameterized with the value 
type, so that in RelNode-and-RexNode-land a measure column whose value is of 
type {{INTEGER}} would have type {{MEASURE<INTEGER>}}. (In SqlNode-land its 
type would be {{INTEGER}} and we would tell that it was a measure by some other 
means.)

This change also adds an aggregate function called {{AGGREGATE}} that evaluates 
measures in the current {{GROUP BY}} context. (You can think of this as letting 
the measures roll themselves up as only they know how. For example, if the 
{{sum_price}} measure is defined as {{SUM(price)}} then if I write 
{{AGGREGATE(sum_price)}} in my query it's as if I wrote {{SUM(price)}}. But we 
also support measures that have more complex formulas.)



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to