Skip to content

ESQL: only 400 response on IllegalArgumentException in the compute engine #126198

Closed
@alex-spies

Description

@alex-spies

To reproduce: Check out main before #125764 was merged. Run a local ES instance via ./gradlew run and ingest the csv test data:

./gradlew :x-pack:plugin:esql:qa:testFixtures:loadCsvSpecData --args="http://elastic-admin:elastic-password@localhost:9200"

Run the following query (until it errors, it's slightly non-deterministic):

from *    
| enrich languages_policy on author.keyword
| sort book_no
| limit 1

This gives a 400 when it errors. Running with error_trace shows that it's due to a mismatch in data types (originally from a wrong layout):

 Expected [BYTES_REF] but was [INT]
...
Caused by: java.lang.IllegalArgumentException: Expected [BYTES_REF] but was [INT]
  \tat org.elasticsearch.compute.operator.topn.ValueExtractor.extractorFor(ValueExtractor.java:30)
  \tat org.elasticsearch.compute.operator.topn.TopNOperator$RowFiller.<init>(TopNOperator.java:150)
  \tat org.elasticsearch.compute.operator.topn.TopNOperator.addInput(TopNOperator.java:371)
  \tat org.elasticsearch.compute.operator.Driver.runSingleLoopIteration(Driver.java:276)
...

I believe this IAE should've triggered a 500 response; returning 400 can obscure a bug in the compute engine.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions