Details
-
Improvement
-
Status: Closed
-
Critical
-
Resolution: Won't Fix
-
1.0.1
-
None
-
None
Description
When we type
select deptno, name, max(age) from dept group by deptno;
in calcite or Oracle, it will complain
Expression 'NAME' is not being grouped
or
Column 'dept.name' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
because of the nondeterministic result.
Therefore, I suggest to separate the current functionality of `select` into two api, the new `select` only handle scalar expressions, and an `agg` accept Aggregates.
def select(exprs: Expression*)
def agg(aggs: Aggregation*)
....
tbl.groupBy('deptno)
.agg('age.max, 'age.min)