Aleksey Plekhanov created IGNITE-16191:
------------------------------------------

             Summary: Calcite engine. Unexpected result of COUNT with multiple 
parameters
                 Key: IGNITE-16191
                 URL: https://issues.apache.org/jira/browse/IGNITE-16191
             Project: Ignite
          Issue Type: Bug
            Reporter: Aleksey Plekhanov


The calcite engine supports the {{COUNT}} aggregate function with multiple 
parameters. Such a function should return the number of input rows for which 
parameters are wholly not null.

But currently queries like: 
{noformat}
SELECT COUNT(null, 1)
SELECT COUNT(1, null)
{noformat}
Return 0 (expected 1).
Query:
{noformat}
SELECT COUNT(null, null)
{noformat}
Throw an exception:
{noformat}
Caused by: java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
        at java.util.ArrayList.rangeCheck(ArrayList.java:657)
        at java.util.ArrayList.get(ArrayList.java:433)
        at 
org.apache.ignite.internal.processors.query.calcite.exec.exp.agg.AccumulatorsFactory$WrapperPrototype$1.apply(AccumulatorsFactory.java:226)
        at 
org.apache.ignite.internal.processors.query.calcite.exec.exp.agg.AccumulatorsFactory$WrapperPrototype$1.apply(AccumulatorsFactory.java:223)
        at 
org.apache.ignite.internal.processors.query.calcite.exec.exp.agg.AccumulatorsFactory$AccumulatorWrapperImpl.add(AccumulatorsFactory.java:305)
        at 
org.apache.ignite.internal.processors.query.calcite.exec.rel.HashAggregateNode$Grouping.addOnMapper(HashAggregateNode.java:294)
        at 
org.apache.ignite.internal.processors.query.calcite.exec.rel.HashAggregateNode$Grouping.add(HashAggregateNode.java:265)
        at 
org.apache.ignite.internal.processors.query.calcite.exec.rel.HashAggregateNode$Grouping.access$100(HashAggregateNode.java:222)
        at 
org.apache.ignite.internal.processors.query.calcite.exec.rel.HashAggregateNode.push(HashAggregateNode.java:127)
        at 
org.apache.ignite.internal.processors.query.calcite.exec.rel.ScanNode.push(ScanNode.java:107)
{noformat}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to