Commit 58944ac
authored
to hotfix: fix block filter (#23239)
### **User description**
## What type of PR is this?
- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [ ] Test and CI
- [ ] Code Refactoring
## Which issue(s) this PR fixes:
issue ##13959
## What this PR does / why we need it:
fix block filter EQ, IN, ...
___
### **PR Type**
Bug fix
___
### **Description**
- Fix block filter search functions to correctly handle duplicate values
- Add early return checks for empty input vectors or value sets
- Refactor binary search logic to find all matching occurrences, not
just first
- Improve handling of consecutive duplicate values in search results
___
### Diagram Walkthrough
```mermaid
flowchart LR
A["Search Functions<br/>OrderedBinarySearch<br/>VarlenBinarySearch<br/>FixedSizedBinarySearch"] -->|"Add empty input checks"| B["Early Return<br/>for empty data"]
A -->|"Refactor duplicate handling"| C["Find All Matches<br/>for each value"]
C -->|"Collect consecutive<br/>duplicates"| D["Return Complete<br/>Result Set"]
E["Test Suite"] -->|"Verify correctness"| D
```
<details><summary><h3>File Walkthrough</h3></summary>
<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Bug
fix</strong></td><td><table>
<tr>
<td>
<details>
<summary><strong>search.go</strong><dd><code>Fix duplicate value
handling in block filter searches</code>
</dd></summary>
<hr>
pkg/container/vector/search.go
<ul><li>Add empty input validation to
<code>OrderedBinarySearchOffsetByValFactory</code>,
<br><code>VarlenBinarySearchOffsetByValFactory</code>, and
<br><code>FixedSizedBinarySearchOffsetByValFactory</code><br> <li>
Refactor small set binary search to find all consecutive duplicate
<br>matches instead of just first occurrence<br> <li> Refactor large set
merge-based search to collect all matching rows for <br>each search
value<br> <li> Optimize search by skipping duplicate search values and
tracking <br>position ranges</ul>
</details>
</td>
<td><a
href="https://github.com/matrixorigin/matrixone/pull/23239/files#diff-695b38a9e60790ac9b8f2a15f87cc805526f3224c653603aab0f4834175ae12a">+120/-56</a></td>
</tr>
</table></td></tr><tr><td><strong>Tests</strong></td><td><table>
<tr>
<td>
<details>
<summary><strong>search_test.go</strong><dd><code>Add comprehensive
tests for search functions</code>
</dd></summary>
<hr>
pkg/container/vector/search_test.go
<ul><li>Add comprehensive test for varlen binary search with small
duplicate <br>value set<br> <li> Add large dataset test with 400
elements and duplicate search targets<br> <li> Add empty input edge case
tests for varlen search<br> <li> Add benchmark tests for varlen search
with various hit rates<br> <li> Add tests for ordered and fixed-sized
binary search with duplicate <br>values</ul>
</details>
</td>
<td><a
href="https://github.com/matrixorigin/matrixone/pull/23239/files#diff-89ef9dc829c9acb31f1cee3249f1a0ac69995ab1c28042ae9f7174f8a6be14a3">+292/-0</a>
</td>
</tr>
</table></td></tr></tbody></table>
</details>
___1 parent 87ea5b8 commit 58944ac
2 files changed
Lines changed: 426 additions & 56 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
356 | 356 | | |
357 | 357 | | |
358 | 358 | | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
359 | 362 | | |
360 | 363 | | |
361 | 364 | | |
| |||
367 | 370 | | |
368 | 371 | | |
369 | 372 | | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
370 | 376 | | |
371 | 377 | | |
372 | 378 | | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
377 | 387 | | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
| 388 | + | |
| 389 | + | |
385 | 390 | | |
386 | 391 | | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
387 | 404 | | |
388 | 405 | | |
389 | 406 | | |
390 | 407 | | |
391 | 408 | | |
392 | 409 | | |
393 | | - | |
394 | | - | |
395 | | - | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
396 | 421 | | |
397 | 422 | | |
398 | 423 | | |
| |||
409 | 434 | | |
410 | 435 | | |
411 | 436 | | |
412 | | - | |
| 437 | + | |
413 | 438 | | |
414 | 439 | | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
415 | 443 | | |
416 | 444 | | |
417 | 445 | | |
418 | | - | |
| 446 | + | |
419 | 447 | | |
420 | 448 | | |
421 | | - | |
| 449 | + | |
422 | 450 | | |
423 | 451 | | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
424 | 455 | | |
425 | 456 | | |
426 | 457 | | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
431 | 465 | | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
| 466 | + | |
| 467 | + | |
439 | 468 | | |
440 | 469 | | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
441 | 482 | | |
442 | 483 | | |
443 | 484 | | |
444 | 485 | | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
| 486 | + | |
| 487 | + | |
449 | 488 | | |
450 | | - | |
451 | | - | |
452 | | - | |
453 | | - | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
454 | 499 | | |
455 | | - | |
456 | | - | |
457 | 500 | | |
458 | 501 | | |
459 | | - | |
460 | | - | |
461 | | - | |
462 | | - | |
463 | 502 | | |
464 | 503 | | |
465 | 504 | | |
| |||
474 | 513 | | |
475 | 514 | | |
476 | 515 | | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
477 | 519 | | |
478 | 520 | | |
479 | 521 | | |
| |||
486 | 528 | | |
487 | 529 | | |
488 | 530 | | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
489 | 534 | | |
490 | 535 | | |
491 | 536 | | |
492 | | - | |
493 | | - | |
494 | | - | |
495 | | - | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
496 | 545 | | |
497 | | - | |
498 | | - | |
499 | | - | |
500 | | - | |
501 | | - | |
502 | | - | |
503 | | - | |
| 546 | + | |
| 547 | + | |
504 | 548 | | |
505 | 549 | | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
506 | 562 | | |
507 | 563 | | |
508 | 564 | | |
509 | 565 | | |
510 | 566 | | |
511 | 567 | | |
512 | 568 | | |
513 | | - | |
514 | | - | |
515 | | - | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
516 | 580 | | |
517 | 581 | | |
518 | 582 | | |
| |||
0 commit comments