You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Evgeny Stanilovsky (Jira)" <ji...@apache.org> on 2022/12/14 11:53:00 UTC
[jira] [Updated] (IGNITE-18412) Sql. Use an alias that is identical to a column name - failed.
[ https://issues.apache.org/jira/browse/IGNITE-18412?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Evgeny Stanilovsky updated IGNITE-18412:
----------------------------------------
Description:
1. Use an alias that is identical to a column name
(should prioritize column name):
{noformat}
CREATE TABLE integers(i INTEGER, j INTEGER);
INSERT INTO integers VALUES (3, 4), (3, 4), (2, 4);
# use an alias that is identical to a column name (should prioritize column name)
query IR
SELECT 1 AS i, SUM(i) FROM integers GROUP BY i ORDER BY 2;
----
1 2.000000
1 6.000000{noformat}
Error:
{noformat}
[expectedRows=2, actualRows=1, expected=[[1, 2.000000], [1, 6.000000]], actual=[[1, 8]]]{noformat}
BTW PG with equivalent data returns:
{noformat}
1 2
1 6{noformat}
2. Column reference should have preference over alias reference in grouping
{noformat}
CREATE TABLE integers(i INTEGER);
INSERT INTO integers VALUES (1), (2), (3), (NULL);
SELECT i, i % 2 AS i, SUM(i) FROM integers GROUP BY i ORDER BY 1 NULLS FIRST;
----
NULL NULL NULL
1 1 1.000000
2 0 2.000000
3 1 3.000000
{noformat}
Caused by: org.apache.calcite.runtime.CalciteContextException: At line 1, column 53: Column 'I' is ambiguous
was:
Use an alias that is identical to a column name
(should prioritize column name):
{noformat}
CREATE TABLE integers(i INTEGER, j INTEGER);
INSERT INTO integers VALUES (3, 4), (3, 4), (2, 4);
# use an alias that is identical to a column name (should prioritize column name)
query IR
SELECT 1 AS i, SUM(i) FROM integers GROUP BY i ORDER BY 2;
----
1 2.000000
1 6.000000{noformat}
Error:
{noformat}
[expectedRows=2, actualRows=1, expected=[[1, 2.000000], [1, 6.000000]], actual=[[1, 8]]]{noformat}
BTW PG with equivalent data returns:
{noformat}
1 2
1 6{noformat}
> Sql. Use an alias that is identical to a column name - failed.
> --------------------------------------------------------------
>
> Key: IGNITE-18412
> URL: https://issues.apache.org/jira/browse/IGNITE-18412
> Project: Ignite
> Issue Type: Bug
> Components: sql
> Affects Versions: 3.0.0-beta1
> Reporter: Evgeny Stanilovsky
> Priority: Major
> Labels: ignite-3
>
> 1. Use an alias that is identical to a column name
> (should prioritize column name):
> {noformat}
> CREATE TABLE integers(i INTEGER, j INTEGER);
> INSERT INTO integers VALUES (3, 4), (3, 4), (2, 4);
> # use an alias that is identical to a column name (should prioritize column name)
> query IR
> SELECT 1 AS i, SUM(i) FROM integers GROUP BY i ORDER BY 2;
> ----
> 1 2.000000
> 1 6.000000{noformat}
> Error:
> {noformat}
> [expectedRows=2, actualRows=1, expected=[[1, 2.000000], [1, 6.000000]], actual=[[1, 8]]]{noformat}
> BTW PG with equivalent data returns:
> {noformat}
> 1 2
> 1 6{noformat}
>
> 2. Column reference should have preference over alias reference in grouping
>
> {noformat}
> CREATE TABLE integers(i INTEGER);
> INSERT INTO integers VALUES (1), (2), (3), (NULL);
> SELECT i, i % 2 AS i, SUM(i) FROM integers GROUP BY i ORDER BY 1 NULLS FIRST;
> ----
> NULL NULL NULL
> 1 1 1.000000
> 2 0 2.000000
> 3 1 3.000000
> {noformat}
>
> Caused by: org.apache.calcite.runtime.CalciteContextException: At line 1, column 53: Column 'I' is ambiguous
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)