Commit e533a78
committed
Fix opaque NullPointerException for unresolvable alias-type field path
When a mapping contains a field of "type": "alias" whose "path" points to
a target absent from the flattened mapping (a text multi-field such as
field.keyword, or a removed/renamed field), validateAliasType passed a null
target into the OpenSearchAliasType constructor, which dereferenced it at
super(type.getExprCoreType()) and surfaced an opaque NullPointerException.
Guard the null target and throw a SemanticCheckException naming the alias
field and its unresolved path. SemanticCheckException extends
QueryEngineException, so JdbcResponseFormatter maps it to HTTP 400 (client
error) rather than the misleading 500 a generic exception would produce.
Add unit tests covering the .keyword multi-field and missing-field cases.
Fixes opensearch-project#5535
Signed-off-by: Jialiang Liang <jiallian@amazon.com>1 parent 804d4f1 commit e533a78
2 files changed
Lines changed: 50 additions & 1 deletion
File tree
- opensearch/src
- main/java/org/opensearch/sql/opensearch/data/type
- test/java/org/opensearch/sql/opensearch/data/type
Lines changed: 12 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
297 | 298 | | |
298 | 299 | | |
299 | 300 | | |
300 | | - | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
301 | 312 | | |
302 | 313 | | |
303 | 314 | | |
| |||
Lines changed: 38 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| |||
483 | 484 | | |
484 | 485 | | |
485 | 486 | | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
486 | 524 | | |
487 | 525 | | |
488 | 526 | | |
| |||
0 commit comments