[
https://issues.apache.org/jira/browse/SPARK-13957?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Reynold Xin updated SPARK-13957:
--------------------------------
Description:
This is to support order by position in SQL, e.g.
{noformat}
select c1, c2, c3, sum(*) from tbl group by by 1, 3, c4
{noformat}
should be equivalent to
{noformat}
select c1, c2, c3, sum(*) from tbl order by c1, c3, c4
{noformat}
We only convert integer literals (not foldable expressions).
For positions that are aggregate functions, an analysis exception should be
thrown, e.g. in postgres;
{noformat}
rxin=# select 'one', 'two', count(*) from r1 group by 1, 3;
ERROR: aggregate functions are not allowed in GROUP BY
LINE 1: select 'one', 'two', count(*) from r1 group by 1, 3;
^
{noformat}
This should be controlled by config option spark.sql.groupByOrdinal.
was:
This is to support order by position in SQL, e.g.
{noformat}
select c1, c2, c3, sum(*) from tbl group by by 1, 3, c4
{noformat}
should be equivalent to
{noformat}
select c1, c2, c3, sum(*) from tbl order by c1, c3, c4
{noformat}
We only convert integer literals (not foldable expressions).
For positions that are aggregate functions, an analysis exception should be
thrown, e.g. in postgres;
{noformat}
rxin=# select 'one', 'two', count(*) from r1 group by 1, 3;
ERROR: aggregate functions are not allowed in GROUP BY
LINE 1: select 'one', 'two', count(*) from r1 group by 1, 3;
^
{noformat}
> Support group by ordinal in SQL
> -------------------------------
>
> Key: SPARK-13957
> URL: https://issues.apache.org/jira/browse/SPARK-13957
> Project: Spark
> Issue Type: Improvement
> Components: SQL
> Reporter: Reynold Xin
>
> This is to support order by position in SQL, e.g.
> {noformat}
> select c1, c2, c3, sum(*) from tbl group by by 1, 3, c4
> {noformat}
> should be equivalent to
> {noformat}
> select c1, c2, c3, sum(*) from tbl order by c1, c3, c4
> {noformat}
> We only convert integer literals (not foldable expressions).
> For positions that are aggregate functions, an analysis exception should be
> thrown, e.g. in postgres;
> {noformat}
> rxin=# select 'one', 'two', count(*) from r1 group by 1, 3;
> ERROR: aggregate functions are not allowed in GROUP BY
> LINE 1: select 'one', 'two', count(*) from r1 group by 1, 3;
> ^
> {noformat}
> This should be controlled by config option spark.sql.groupByOrdinal.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]