Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-22259

Sql. ArrayIndexOutOfBoundsException on COUNT(DISTINCT) aggregate.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 3.0.0-beta1
    • 3.0.0-beta2
    • sql

    Description

      to reproduce :

          @Test
          @WithSystemProperty(key = "IMPLICIT_PK_ENABLED", value = "true")
          public void test0() {
              sql("CREATE TABLE tbl_ProductSales (ColID int, Product_Category  varchar(64), Product_Name  varchar(64), TotalSales int);");
              sql("CREATE TABLE another_T (col1 INT, col2 INT, col3 INT, col4 INT, col5 INT, col6 INT, col7 INT, col8 INT);");
              sql("INSERT INTO tbl_ProductSales VALUES (1,'Game','Mobo Game',200),(2,'Game','PKO Game',400),(3,'Fashion','Shirt',500),(4,'Fashion','Shorts',100);");
              sql("INSERT INTO another_T VALUES (1,2,3,4,5,6,7,8), (11,22,33,44,55,66,77,88), (111,222,333,444,555,666,777,888), (1111,2222,3333,4444,5555,6666,7777,8888);");
              List<List<Object>> res = sql(
                      "SELECT (SELECT MIN(ColID) FROM tbl_ProductSales INNER JOIN another_T t2 ON t1.col7 <> ANY(SELECT MAX(t1.col1 + t3.col4) FROM another_T t3)) FROM another_T t1;");
      
              res.get(0);
          }
      

      throws :

      Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
      	at org.apache.ignite.internal.sql.engine.exec.exp.agg.Accumulators$DistinctAccumulator.add(Accumulators.java:774)
      	at org.apache.ignite.internal.sql.engine.exec.exp.agg.AccumulatorsFactory$AccumulatorWrapperImpl.add(AccumulatorsFactory.java:313)
      	at org.apache.ignite.internal.sql.engine.exec.exp.agg.AggregateRow.update(AggregateRow.java:61)
      	at org.apache.ignite.internal.sql.engine.exec.rel.HashAggregateNode$Grouping.add(HashAggregateNode.java:260)
      

      this statement is a part of test_grouped_correlated_subquery.test_ignore

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: