[
https://issues.apache.org/jira/browse/CALCITE-1710?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15935627#comment-15935627
]
lincoln.lee commented on CALCITE-1710:
--------------------------------------
Actually, SQL Server support GROUP BY {code}x%y{code} and {code}select 1 + x +
y from t group by x + y {code}
not mentioned on the page but allowed.
{code}
1> select h%3 as h_mod, count(g) as cnt from tuple5 group by h%3;
2> go
h_mod cnt
----------- -----------
0 3
1 5
2 7
(3 rows affected)
1> select 1+d+h, count(g) from tuple5 group by d,h;
2> go
----------- -----------
3 1
4 1
6 2
7 1
5 1
6 2
7 2
8 2
7 1
9 2
(10 rows affected)
{code}
> GroupBy columns support arithmetic expression
> ---------------------------------------------
>
> Key: CALCITE-1710
> URL: https://issues.apache.org/jira/browse/CALCITE-1710
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Reporter: lincoln.lee
> Assignee: Julian Hyde
> Priority: Minor
>
> Currently only original column reference(s) and column(s) with UDF valid in
> group by clause but arithmetic expression(s) not allowed, while most RDBMS
> support
> like thus:
> {code}
> SELECT
> ColumnA + ColumnB
> FROM T
> GROUP BY ColumnA + ColumnB;
>
> SELECT
> ColumnA + ColumnB + constant
> FROM T
> GROUP BY ColumnA, ColumnB;
> SELECT
> ColumnA % 3
> FROM T
> GROUP BY ColumnA %3;
> {code}
> we can treat these arithmetic operators as builtin UDFs and support these
> kind of query, it'll be a useful feature.
> What do you think?
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)