From a6137e0a65726110b451fbfbc2ff04a89e1e5bc5 Mon Sep 17 00:00:00 2001 From: Alexander Spies Date: Fri, 6 Jun 2025 11:37:53 +0200 Subject: [PATCH] ESQL: Throw ISE instead of IAE for illegal block in page (#128960) IAE gets reported as a 400 status code, but that's inappropriate when inconsistent pages are always bugs, and should be reported with a 500. Throw ISE instead. --- docs/changelog/128960.yaml | 5 +++++ .../src/main/java/org/elasticsearch/compute/data/Page.java | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 docs/changelog/128960.yaml diff --git a/docs/changelog/128960.yaml b/docs/changelog/128960.yaml new file mode 100644 index 0000000000000..3721b34894548 --- /dev/null +++ b/docs/changelog/128960.yaml @@ -0,0 +1,5 @@ +pr: 128960 +summary: Throw ISE instead of IAE for illegal block in page +area: ES|QL +type: bug +issues: [] diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/Page.java b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/Page.java index 2e46735bd5bd1..59dae4ade25e8 100644 --- a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/Page.java +++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/Page.java @@ -83,7 +83,7 @@ private Page(boolean copyBlocks, int positionCount, Block[] blocks) { private Page(Page prev, Block[] toAdd) { for (Block block : toAdd) { if (prev.positionCount != block.getPositionCount()) { - throw new IllegalArgumentException( + throw new IllegalStateException( "Block [" + block + "] does not have same position count: " + block.getPositionCount() + " != " + prev.positionCount ); }