From 5242d380bfad7a6bf351a10579d56f5e60ff55bb Mon Sep 17 00:00:00 2001 From: Ignacio Vera Date: Fri, 23 May 2025 09:16:53 +0200 Subject: [PATCH] Change exceptions to IllegalArgumentException in GroupingDocValuesSelector --- .../lucene/grouping/GroupingDocValuesSelector.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/lucene/grouping/GroupingDocValuesSelector.java b/server/src/main/java/org/elasticsearch/lucene/grouping/GroupingDocValuesSelector.java index fe076c7155c8e..a79a28a9e01b6 100644 --- a/server/src/main/java/org/elasticsearch/lucene/grouping/GroupingDocValuesSelector.java +++ b/server/src/main/java/org/elasticsearch/lucene/grouping/GroupingDocValuesSelector.java @@ -100,7 +100,7 @@ public void setNextReader(LeafReaderContext readerContext) throws IOException { public boolean advanceExact(int target) throws IOException { if (sorted.advanceExact(target)) { if (sorted.docValueCount() > 1) { - throw new IllegalStateException( + throw new IllegalArgumentException( "failed to extract doc:" + target + ", the grouping field must be single valued" ); } @@ -124,7 +124,7 @@ public long longValue() throws IOException { }; } } - default -> throw new IllegalStateException("unexpected doc values type " + type + "` for field `" + field + "`"); + default -> throw new IllegalArgumentException("unexpected doc values type " + type + "` for field `" + field + "`"); } } @@ -200,7 +200,7 @@ public void setNextReader(LeafReaderContext readerContext) throws IOException { public boolean advanceExact(int target) throws IOException { if (sorted.advanceExact(target)) { if (sorted.docValueCount() > 1) { - throw new IllegalStateException( + throw new IllegalArgumentException( "failed to extract doc:" + target + ", the grouping field must be single valued" ); } @@ -233,7 +233,7 @@ public int getValueCount() { }; } } - default -> throw new IllegalStateException("unexpected doc values type " + type + "` for field `" + field + "`"); + default -> throw new IllegalArgumentException("unexpected doc values type " + type + "` for field `" + field + "`"); } }