Uploaded image for project: 'Apache AsterixDB'
  1. Apache AsterixDB
  2. ASTERIXDB-1692

Case statement referring to aggregated value throws ArrayIndexOutOfBoundsException

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Component/s: None
    • Labels:
      None
    • Environment:
      Master branch with latest commit 76a4f9e36e841d9325bedb3bb96e7

      Description

      To reproduce the issue, run the following SQL++ statements:

      drop dataverse sampdb if exists;
      create dataverse sampdb;
      use sampdb;
      
      create type samptabletype as closed {
        id1: int8,
        id2:int8?
      };
      
      create dataset samptable1(samptabletype) primary key id1;
      
      insert into samptable1 ({'id1' : 1, 'id2':5});
      insert into samptable1 ({'id1' : 2, 'id2':10});
      
      with st1 as (
      select id1, sum(id2) id2sum
      from samptable1
      group by id1)
      select *
      from st1
      where (case when id2sum > 5 then (id2sum/id2sum) = 1 else true end);
      

      Result:

      4 [ArrayIndexOutOfBoundsException]
      

        Attachments

          Activity

            People

            • Assignee:
              dlychagin-cb Dmitry Lychagin
              Reporter:
              vignesh.raghunathan90 Vignesh Raghunathan
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: