[ 
https://issues.apache.org/jira/browse/CALCITE-5490?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

TJ Banghart reassigned CALCITE-5490:
------------------------------------

    Assignee: TJ Banghart

> Add a 'naiveMeasures' connection property to allow regular aggregate 
> functions (e.g. SUM, MIN) to be used instead of AGGREGATE
> ------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-5490
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5490
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Julian Hyde
>            Assignee: TJ Banghart
>            Priority: Major
>
> When we introduce measures to SQL (see CALCITE-4496) a particular can arise 
> that users know about measures (have added measure columns to their tables 
> and views, and want to use those measures in queries) but their querying 
> tools to not (therefore require an aggregate function when a measure is used 
> in a {{GROUP BY}} query but do not know about the new {{AGGREGATE}} aggregate 
> function (added in CALCITE-5105)).
> This feature would add a new [connection 
> property|https://calcite.apache.org/javadocAggregate/org/apache/calcite/config/CalciteConnectionProperty.html],
>  {{{}naiveMeasures{}}}. Measures and the {{AGGREGATE}} aggregate function are 
> enabled regardless of its setting. If {{{}naiveMeasures=true{}}}, a call to 
> one of the core aggregate functions ({{{}MAX{}}}, {{{}MIN{}}}, {{{}SUM{}}}, 
> {{{}AVG{}}}) whose argument is a measure is deemed to be a call to 
> {{{}AGGREGATE{}}}. If the argument is not a measure, the calls are unchanged.
> For example, if {{naiveMeasures=true}} then
> {code:java}
> SELECT deptno, MAX(avg_sal), MAX(age)
> FROM Emp
> GROUP BY deptno
> {code}
> is translated as if the user had written
> {code:java}
> SELECT deptno, AGGREGATE(avg_sal), MAX(age)
> FROM Emp
> GROUP BY deptno
> {code}
> (The {{avg_sal}} column is a measure, {{age}} is a regular column.)
> If {{{}naiveMeasures=false{}}}, the default, calls to {{{}MAX{}}}, 
> {{{}MIN{}}}, {{{}SUM{}}}, {{AVG}} are unchanged even if their argument is a 
> measure.
> (The semantics of {{MAX(avg_sal)}} are not yet finalized, but one semantics 
> under consideration is that the {{avg_sal}} measure is evaluated - converted 
> from a measure to a value - for each row (employee) and the {{MAX}} aggregate 
> function is then applied to those values.)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to