Skip to content

ESQL: ValueSourceReader sometimes tries to append empty blocks #128959

@alex-spies

Description

@alex-spies

Got this stack trace from Serverless from a simple query:

  java.lang.IllegalArgumentException: Block [BytesRefVectorBlock[vector=BytesRefArrayVector[positions=0]]] does not have same position count: 0 != 10    
   at org.elasticsearch.compute.data.Page.<init>(Page.java:88)                                                                                                                       
   at org.elasticsearch.compute.data.Page.appendBlocks(Page.java:174)                                                                                                                
   at org.elasticsearch.compute.lucene.ValuesSourceReaderOperator.process(ValuesSourceReaderOperator.java:174)                                                                       
   at org.elasticsearch.compute.operator.AbstractPageMappingOperator.getOutput(AbstractPageMappingOperator.java:85)                                                                  
   at org.elasticsearch.compute.operator.Driver.runSingleLoopIteration(Driver.java:265)                                                                                              
   at org.elasticsearch.compute.operator.Driver.run(Driver.java:185)                                                                
   at org.elasticsearch.compute.operator.Driver$1.doRun(Driver.java:406)                                                            
   at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:27)                                       
   at org.elasticsearch.compute.operator.DriverScheduler$1.doRun(DriverScheduler.java:57)                                           
   at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:27)                                       
   at org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:35)                                           
   at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:1044)       
   at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:27)                                       
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1095)                                               
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:619)                                               
   at java.lang.Thread.run(Thread.java:1447)

This indicates that the ValueSourceReaderOperator tries to append blocks with 0 positions, even though we should fetch field values for 10 positions.

The query that triggered this was simple and in essence

FROM idx | WHERE field == "value"

together with a specific time range picked via the filter request field. idx is actually a data stream, which may be relevant. Happened for some time ranges, but not for others - maybe due to rollover at some point in time and thus picking up different shards.

In the specific case, field was a constant keyword field; but we also saw problems with just

FROM idx

with a specific time range in the filter request field.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions