You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Vladimir Steshin (Jira)" <ji...@apache.org> on 2021/11/26 10:25:00 UTC
[jira] [Assigned] (IGNITE-15993) Calcite engine. Wrong result for single-value aggregation from empty source
[ https://issues.apache.org/jira/browse/IGNITE-15993?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Vladimir Steshin reassigned IGNITE-15993:
-----------------------------------------
Assignee: Vladimir Steshin
> 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: Major
> Labels: calcite2-required, calcite3-required
>
> 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)