Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-5667

Unexpected result with aggregate inside subquery

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Invalid
    • 1.34.0
    • None
    • core
    • None

    Description

       

      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
      

       

      but obtain :

       

      1
      2
      

      appropriate Quidem test for blank.iq

      select (select(sum(I))) from bar;

      explain shows :

       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 }]])

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              zstan Evgeny Stanilovsky
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: