Commit 6adf47e
authored
ESQL: Fix a bug in LuceneQueryExpressionEvaluator (elastic#117252) (elastic#117279)
* ESQL: Fix a bug in LuceneQueryExpressionEvaluator
This fixes Lucene usage bug in `LuceneQueryExpressionEvaluator`, the
evaluator we plan to use to run things like `MATCH` when we *can't* push
it to a source operator. That'll be useful for things like:
```
FROM foo
| STATS COUNT(),
COUNT() WHERE MATCH(message, "error")
```
Explanation:
When using Lucene's `Scorer` and `BulkScorer` you must stay on the same
thread. It's a rule. Most of the time nothing bad happens if you shift
threads, but sometimes things explode and Lucene doesn't work. Driver
can shift from one thread to another - that's just how it's designed.
It's a "yield after running a while" kind of thing.
In tests we sometimes get a version of the `Scorer` and `BulkScorer`
that assert that you don't shift threads. That is what caused this test
failure.
Anyway! This builds protection into `LuceneQueryExpressionEvaluator` so
that if it *does* shift threads then it'll rebuild the `Scorer` and
`BulkScorer`. That makes the test happy and makes even the most grump
Lucene object happy.
Closes elastic#1168791 parent 7ab9097 commit 6adf47e
File tree
1 file changed
+20
-3
lines changed- x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/lucene
1 file changed
+20
-3
lines changedLines changed: 20 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
| 194 | + | |
194 | 195 | | |
195 | 196 | | |
196 | 197 | | |
197 | 198 | | |
198 | 199 | | |
199 | 200 | | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
200 | 206 | | |
201 | 207 | | |
202 | 208 | | |
203 | 209 | | |
204 | 210 | | |
205 | 211 | | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
206 | 217 | | |
207 | 218 | | |
208 | 219 | | |
| |||
223 | 234 | | |
224 | 235 | | |
225 | 236 | | |
226 | | - | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
227 | 241 | | |
228 | 242 | | |
229 | 243 | | |
| |||
257 | 271 | | |
258 | 272 | | |
259 | 273 | | |
260 | | - | |
261 | | - | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
262 | 279 | | |
263 | 280 | | |
264 | 281 | | |
| |||
0 commit comments