# Problem with select query in Crate 3.2.2

**URL:** <https://community.cratedb.com/t/problem-with-select-query-in-crate-3-2-2/153>\
**Category:** CrateDB\
**Created:** [February 16, 2019, 6:39pm UTC](https://community.cratedb.com/t/problem-with-select-query-in-crate-3-2-2/153 "2019-02-16T18:39:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sambhav](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/sambhav/32/293_2.png) [@sambhav](https://community.cratedb.com/u/sambhav)\
**Post date:** [February 16, 2019, 6:39pm UTC](https://community.cratedb.com/t/problem-with-select-query-in-crate-3-2-2/153/1 "2019-02-16T18:39:38Z")

</div>

This is in regards to the following issue. [https://github.com/crate/crate/issues/8112](https://github.com/crate/crate/issues/8112)  
It is closed but I am having a similar issue and also it is very intermittent.

Query: `select count(city), city from test group by city`  
Error Stacktrace:  
`SQLActionException: 500 Internal Server Error 5000 IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.rangeCheck(ArrayList.java:657) at java.util.ArrayList.get(ArrayList.java:433) at io.crate.expression.InputRow.get(InputRow.java:47) at io.crate.execution.engine.collect.InputCollectExpression.setNextRow(InputCollectExpression.java:38) at io.crate.execution.engine.collect.InputCollectExpression.setNextRow(InputCollectExpression.java:26) at io.crate.execution.engine.collect.GroupByOptimizedIterator.applyAggregatesGroupedByKey(GroupByOptimizedIterator.java:290) at io.crate.execution.engine.collect.GroupByOptimizedIterator.lambda$tryOptimizeSingleStringKey$3(GroupByOptimizedIterator.java:183) at io.crate.data.CollectingBatchIterator.loadNextBatch(CollectingBatchIterator.java:135) at io.crate.data.CloseAssertingBatchIterator.loadNextBatch(CloseAssertingBatchIterator.java:69) at io.crate.data.AsyncCompositeBatchIterator.lambda$loadNextBatch$1(AsyncCompositeBatchIterator.java:131) at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590) at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:624) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)`

_After hours of research, I am still unable to get the exact solution. Any help would be much appreciated._

---

<div class="post-metadata">

**Author:** ![nocturnaltortoise](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/nocturnaltortoise/32/67_2.png) [@nocturnaltortoise](https://community.cratedb.com/u/nocturnaltortoise)\
**Post date:** [February 28, 2019, 3:29pm UTC](https://community.cratedb.com/t/problem-with-select-query-in-crate-3-2-2/153/2 "2019-02-28T15:29:49Z")

</div>

I have had the same issue on crate 3.2.2
