Commit af73737
committed
Force script fallback for nested IS NULL / IS NOT NULL
ExistsQuery.canSupport() already returns false for nested references, but
the default branch of FilterQueryBuilder.visitFunction() has a second
dispatch: when canSupport() is false, it checks isNestedPredicate() and, if
true, routes to NestedQuery.buildNested(func, query). That helper reads
func.getArguments().get(1) on the assumption of a binary predicate shape,
so unary IS NULL / IS NOT NULL would throw at runtime.
Override isNestedPredicate() to return false in ExistsQuery so the dispatch
falls through to the compiled-script path for nested-field predicates. Add
unit tests covering both IS NULL and IS NOT NULL to lock in the fallback.
Signed-off-by: Eric Wei <mengwei.eric@gmail.com>1 parent cbb928b commit af73737
2 files changed
Lines changed: 56 additions & 0 deletions
File tree
- opensearch/src
- main/java/org/opensearch/sql/opensearch/storage/script/filter/lucene
- test/java/org/opensearch/sql/opensearch/storage/script/filter
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
48 | 59 | | |
49 | 60 | | |
50 | 61 | | |
| |||
Lines changed: 45 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
208 | 253 | | |
209 | 254 | | |
210 | 255 | | |
| |||
0 commit comments