Index_out_of_bounds_exception

I am running a select query as below

select count(attributes[‘machinestatus’])
from gra.transactions group by attributes[‘machinestatus’];
and getting error,
SQLActionException [NotSerializableExceptionWrapper: index_out_of_bounds_exception: Index: 0, Size: 0]"

Crate Version 3.2.7
There is no error if I do count(*) or even there is no error when same query is executed for regular columns. The error is thrown only in case of dynamic/nested attribute.

The create table has
“attributes” OBJECT (DYNAMIC) AS (
“machinestatus” STRING
)

Hello @tusharsutar28,

can you post the stack trace of the error as well (when using crash enable with \verbose or in the admin-ui check the show error trace option)?

Can you also provide the full CREATE TABLE statement?

Thanks,
Johannes

Hi @jayeff

Crate table query,
CREATE TABLE IF NOT EXISTS “gra”.“transactions” (
“accountid” LONG,
“accountname” STRING,
“attributes” OBJECT (DYNAMIC) AS (
“machinestatus” STRING,
),
“auditdate” TIMESTAMP,
“employeeid” STRING,
“eventdate” TIMESTAMP,
“eventday” TIMESTAMP,
“eventdesc” STRING,
“eventtype” STRING,
“gmteventdate” TIMESTAMP,
“id” LONG,
“ipaddress” STRING,
“machineid” STRING,
“resourceid” LONG,
“resourcename” STRING,
“riskscore” DOUBLE,
“userid” LONG,
PRIMARY KEY (“eventday”, “resourceid”, “id”),
INDEX “all_columns_ft” USING FULLTEXT (“ipaddress”, “employeeid”, “eventdesc”, “machineid”, “accountname”, “eventtype”, “resourcename”) WITH (
analyzer = ‘standard’
)
)
CLUSTERED INTO 7 SHARDS
PARTITIONED BY (“eventday”)
WITH (
“allocation.max_retries” = 5,
“blocks.metadata” = false,
“blocks.read” = false,
“blocks.read_only” = false,
“blocks.read_only_allow_delete” = false,
“blocks.write” = false,
column_policy = ‘dynamic’,
“mapping.total_fields.limit” = 1000,
max_ngram_diff = 1,
max_shingle_diff = 3,
number_of_replicas = ‘1’,
refresh_interval = 1000,
“routing.allocation.enable” = ‘all’,
“routing.allocation.total_shards_per_node” = -1,
“translog.durability” = ‘ASYNC’,
“translog.flush_threshold_size” = 536870912,
“translog.sync_interval” = 5000,
“unassigned.node_left.delayed_timeout” = 60000,
“warmer.enabled” = true,
“write.wait_for_active_shards” = ‘ALL’
)

Full error stack trace,
SQLActionException: 500 Internal Server Error 5000 IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)
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:291)
at io.crate.execution.engine.collect.GroupByOptimizedIterator.lambda$tryOptimizeSingleStringKey$3(GroupByOptimizedIterator.java:183)
at io.crate.data.CollectingBatchIterator.loadNextBatch(CollectingBatchIterator.java:142)
at io.crate.data.CloseAssertingBatchIterator.loadNextBatch(CloseAssertingBatchIterator.java:69)
at io.crate.data.BatchIterators.collect(BatchIterators.java:77)
at io.crate.data.BatchIterators.collect(BatchIterators.java:45)
at io.crate.data.CollectingBatchIterator.lambda$newInstance$2(CollectingBatchIterator.java:86)
at io.crate.data.CollectingBatchIterator.loadNextBatch(CollectingBatchIterator.java:142)
at io.crate.data.CloseAssertingBatchIterator.loadNextBatch(CloseAssertingBatchIterator.java:69)
at io.crate.data.MappedForwardingBatchIterator.loadNextBatch(MappedForwardingBatchIterator.java:52)
at io.crate.data.LimitingBatchIterator.loadNextBatch(LimitingBatchIterator.java:72)
at io.crate.data.MappedForwardingBatchIterator.loadNextBatch(MappedForwardingBatchIterator.java:52)
at io.crate.data.MappedForwardingBatchIterator.loadNextBatch(MappedForwardingBatchIterator.java:52)
at io.crate.action.sql.RowConsumerToResultReceiver.consumeIt(RowConsumerToResultReceiver.java:85)
at io.crate.action.sql.RowConsumerToResultReceiver.accept(RowConsumerToResultReceiver.java:50)
at io.crate.execution.engine.InterceptingRowConsumer.lambda$tryForwardResult$1(InterceptingRowConsumer.java:86)
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:624)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

Just to bring this to your attention,
same query used to work for crate version 2.3.2

Hi @tusharsutar28,

I misread the provided version as 4.2.7 last time I responded.

Sorry to inform you that we no longer support version 3.2.7. I suggest to upgrade to a current version as probably this bug is fixed there already.

Best regards,
Johannes