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

Maksim Zhuravkov updated IGNITE-18673:
--------------------------------------
    Description: 
The first query fails:

{code:java}
SELECT a % 2, b FROM test UNION SELECT a % 2 AS k FROM test ORDER BY -1
{code}
Error:
{code:java}
>From line 1, column 40 to line 1, column 49: Column count mismatch in UNION
{code}

But the second gets executed:
{code:java}
SELECT a % 2, b FROM test UNION SELECT a % 2 AS k, b FROM test ORDER BY -1
{code}

An error message produced by the first query gives us a clue that the ORDER BY 
clause is not checked at all.

The simple example:

{code:java}
SELECT * FROM test ORDER BY -1
{code}


  was:
The first query fails:

{code:java}
SELECT a % 2, b FROM test UNION SELECT a % 2 AS k FROM test ORDER BY -1
{code}
Error:
{code:java}
>From line 1, column 40 to line 1, column 49: Column count mismatch in UNION
{code}

But the second gets executed:
{code:java}
SELECT a % 2, b FROM test UNION SELECT a % 2 AS k, b FROM test ORDER BY -1
{code}

An error message produced by the first query gives us a clue that the ORDER BY 
clause is not checked at all.


> Sql. Negative column indexes in ORDER BY clause are not rejected
> ----------------------------------------------------------------
>
>                 Key: IGNITE-18673
>                 URL: https://issues.apache.org/jira/browse/IGNITE-18673
>             Project: Ignite
>          Issue Type: Bug
>          Components: sql
>            Reporter: Maksim Zhuravkov
>            Priority: Major
>              Labels: calcite2-required, calcite3-required, ignite-3
>             Fix For: 3.0.0-beta2
>
>
> The first query fails:
> {code:java}
> SELECT a % 2, b FROM test UNION SELECT a % 2 AS k FROM test ORDER BY -1
> {code}
> Error:
> {code:java}
> From line 1, column 40 to line 1, column 49: Column count mismatch in UNION
> {code}
> But the second gets executed:
> {code:java}
> SELECT a % 2, b FROM test UNION SELECT a % 2 AS k, b FROM test ORDER BY -1
> {code}
> An error message produced by the first query gives us a clue that the ORDER 
> BY clause is not checked at all.
> The simple example:
> {code:java}
> SELECT * FROM test ORDER BY -1
> {code}



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

Reply via email to