[ 
https://issues.apache.org/jira/browse/IGNITE-15993?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17488037#comment-17488037
 ] 

Aleksey Plekhanov commented on IGNITE-15993:
--------------------------------------------

Calcite version was updated, I've uncommented tests, now they are green, 
[~vladsz83] can you please review?

> Calcite engine. Wrong result for single-value aggregation from empty source
> ---------------------------------------------------------------------------
>
>                 Key: IGNITE-15993
>                 URL: https://issues.apache.org/jira/browse/IGNITE-15993
>             Project: Ignite
>          Issue Type: Bug
>            Reporter: Aleksey Plekhanov
>            Assignee: Vladimir Steshin
>            Priority: Minor
>              Labels: calcite2-required, calcite3-required
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> For example:
> {noformat}
> SELECT (SELECT 1 FROM (SELECT 1) WHERE 1 = 0)
> {noformat}
> Returns 0, but expected {{{}NULL{}}}.
> With correlated queries result even more strange:
> {noformat}
> CREATE TABLE test (a INTEGER)
> INSERT INTO test VALUES (1), (2), (null)
> SELECT (SELECT 1 FROM test t WHERE a = test.a) FROM test
> {noformat}
> Returns 1, 1, 1 (expected 1, 1, NULL)
> Related test {{test_correlated_subquery.test_ignore}}
> From SQL standard:
> {noformat}
> Let SS be a <scalar subquery>.
> Case:
> a) If the cardinality of SS is greater than 1 (one), then an exception 
> condition is raised: cardinality violation.
> b) If the cardinality of SS is 0 (zero), then the value of the <scalar 
> subquery> is the null value.
> c) Otherwise, let C be the column of <query expression> simply contained in 
> SS. The value of SS is the value of C in the unique row of the result of the 
> <scalar subquery>.{noformat}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to