Evgeny Stanilovsky created IGNITE-22259:
-------------------------------------------

             Summary: Sql. ArrayIndexOutOfBoundsException on COUNT(DISTINCT) 
aggregate.
                 Key: IGNITE-22259
                 URL: https://issues.apache.org/jira/browse/IGNITE-22259
             Project: Ignite
          Issue Type: Bug
          Components: sql
    Affects Versions: 3.0.0-beta1
            Reporter: Evgeny Stanilovsky
             Fix For: 3.0.0-beta2


to reproduce :


{code:java}
    @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);
    }
{code}

throws :


{noformat}
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)
{noformat}

this statement is a part of test_grouped_correlated_subquery.test_ignore



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to