You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "Evgeny Stanilovsky (Jira)" <ji...@apache.org> on 2023/04/21 06:42:00 UTC
[jira] [Created] (CALCITE-5667) Unexpected result with aggregate inside subquery
Evgeny Stanilovsky created CALCITE-5667:
-------------------------------------------
Summary: Unexpected result with aggregate inside subquery
Key: CALCITE-5667
URL: https://issues.apache.org/jira/browse/CALCITE-5667
Project: Calcite
Issue Type: Bug
Components: core
Affects Versions: 1.34.0
Reporter: Evgeny Stanilovsky
{noformat}
CREATE TABLE TBL1(ID INT PRIMARY KEY, VAL int);
insert into TBL1 values (1, 1), (2, 2);
select (select(sum(VAL))) from TBL1; <-- await 3 as a result
{noformat}
but obtain :
{noformat}
1
2
{noformat}
appropriate Quidem test for _blank.iq_
{noformat}
select (select(sum(I))) from bar;{noformat}
explain shows :
{noformat}
EnumerableCalc(expr#0..2=[{inputs}], EXPR$0=[$t2])
EnumerableCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{0}])
EnumerableTableScan(table=[[BLANK, BAR]])
EnumerableAggregate(group=[{}], EXPR$0=[SUM($0)])
EnumerableCalc(expr#0=[{inputs}], expr#1=[$cor0], expr#2=[$t1.I], $f0=[$t2])
EnumerableValues(tuples=[[{ 0 }]]){noformat}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)