-
Notifications
You must be signed in to change notification settings - Fork 25.6k
ESQL: Emit warnings on LOOKUP JOIN multivalues #121219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 16 commits
630b673
4692f62
172abd8
91f2684
6bd297d
a801c8e
b82b446
1624f46
2134d83
0f23fea
e134e93
ce0849b
9c37b16
b2c11ad
b0ea3d4
393da75
f40de01
e627316
e6b1e5d
08c8ec0
e9b0456
2bc5bb5
7faf418
12022ad
73e163b
2ec796d
353f3d9
537c0f1
e148592
d5dfaf4
af6f021
7b67a04
98ef65b
af97131
4355bcd
ce19cc6
1bba291
eed7649
511f093
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,15 +46,14 @@ public final class SingleValueMatchQuery extends Query { | |
| * This avoids reporting warnings when queries are not matching multi-values | ||
| */ | ||
| private static final int MULTI_VALUE_MATCH_COST = 1000; | ||
| private static final IllegalArgumentException MULTI_VALUE_EXCEPTION = new IllegalArgumentException( | ||
| "single-value function encountered multi-value" | ||
| ); | ||
| private final IndexFieldData<?> fieldData; | ||
| private final Warnings warnings; | ||
| private final IllegalArgumentException multiValueException; | ||
|
|
||
| public SingleValueMatchQuery(IndexFieldData<?> fieldData, Warnings warnings) { | ||
| public SingleValueMatchQuery(IndexFieldData<?> fieldData, Warnings warnings, String multiValueExceptionMessage) { | ||
| this.fieldData = fieldData; | ||
| this.warnings = warnings; | ||
| this.multiValueException = new IllegalArgumentException(multiValueExceptionMessage); | ||
|
||
| } | ||
|
|
||
| @Override | ||
|
|
@@ -123,7 +122,7 @@ private ScorerSupplier scorerSupplier( | |
| return false; | ||
| } | ||
| if (sortedNumerics.docValueCount() != 1) { | ||
| warnings.registerException(MULTI_VALUE_EXCEPTION); | ||
| warnings.registerException(multiValueException); | ||
| return false; | ||
| } | ||
| return true; | ||
|
|
@@ -158,7 +157,7 @@ private ScorerSupplier scorerSupplier( | |
| return false; | ||
| } | ||
| if (sortedSetDocValues.docValueCount() != 1) { | ||
| warnings.registerException(MULTI_VALUE_EXCEPTION); | ||
| warnings.registerException(multiValueException); | ||
| return false; | ||
| } | ||
| return true; | ||
|
|
@@ -187,7 +186,7 @@ private ScorerSupplier scorerSupplier( | |
| return false; | ||
| } | ||
| if (sortedBinaryDocValues.docValueCount() != 1) { | ||
| warnings.registerException(MULTI_VALUE_EXCEPTION); | ||
| warnings.registerException(multiValueException); | ||
| return false; | ||
| } | ||
| return true; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How did we manage to do this shift without this before? I feel like we shift threads and merge warnings in other ways without requiring this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess rather than make a change to the core warnings stuff I'd prefer we continue to hack around it until we can replace the thread-local-warnings in ESQL. With, like, something else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to what Enrich does (A custom class that does a similar thing, but with all the headers). And moved the logic instead to AsyncOperator, as to avoid repeating it, as it looks quite a standard thing to do there.
Added it to the javadoc too