Commit ca6da43
committed
[BugFix] Surface dedicated error for wildcard or multi-target table in vectorSearch()
vectorSearch() requires a single concrete index because top-k
semantics, dimension checks, and the embedded filter JSON are not
defined across heterogeneous shards. Values like 'sql_vector_*' or
'idx_a,idx_b' were already rejected by the generic SAFE_FIELD_NAME
character-class regex, but surfaced the fallback message
"must contain only alphanumeric characters, dots, underscores, or
hyphens", which does not tell the user what the actual constraint
is.
This change adds a dedicated check (before the regex) that flags
'*' and ',' in the table name and surfaces:
"Invalid table name '...': vectorSearch() requires a single
concrete index or alias; wildcards ('*') and multi-target
patterns (comma-separated) are not supported"
No DSL or execution-path change. Accepted inputs are unchanged
(simple names, dotted names, hyphens, underscores all still pass).
Adds four unit tests (bare '*', trailing '*', mid-name '*',
multi-target ',') and two integration tests pinning the new
message on real queries.
Signed-off-by: Eric Wei <mengwei.eric@gmail.com>1 parent c0faf7c commit ca6da43
3 files changed
Lines changed: 86 additions & 0 deletions
File tree
- integ-test/src/test/java/org/opensearch/sql/sql
- opensearch/src
- main/java/org/opensearch/sql/opensearch/storage
- test/java/org/opensearch/sql/opensearch/storage
Lines changed: 33 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
399 | 399 | | |
400 | 400 | | |
401 | 401 | | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
402 | 435 | | |
403 | 436 | | |
404 | 437 | | |
| |||
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
237 | 250 | | |
238 | 251 | | |
239 | 252 | | |
| |||
Lines changed: 40 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
498 | 498 | | |
499 | 499 | | |
500 | 500 | | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
501 | 541 | | |
502 | 542 | | |
503 | 543 | | |
| |||
0 commit comments