[ 
https://issues.apache.org/jira/browse/IGNITE-16191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17488792#comment-17488792
 ] 

Alexander Belyak commented on IGNITE-16191:
-------------------------------------------

Return "parameters are wholly not null" rows count, but it should return 0, 
isn't it? All rows should be not null, but U pass "null, 1" and "1, null" and 
it should return 0 as I understood.

> 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
>          Components: sql
>            Reporter: Aleksey Plekhanov
>            Assignee: Andrey Mashenkov
>            Priority: Major
>              Labels: calcite3-required
>             Fix For: 2.13
>
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> 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