-
Notifications
You must be signed in to change notification settings - Fork 25.4k
ESQL - KNN functions with non-pushed down filters #131708
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
carlosdelest
wants to merge
27
commits into
elastic:main
Choose a base branch
from
carlosdelest:non-issue/knn-prefilter-non-pushed-down
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
7f313f4
Add exact NN query infra
carlosdelest 2b1a4fa
First version ReplaceKnnWithNoPushedDownFiltersWithEvalTopN
carlosdelest 363e50e
Refactoring and spotless
carlosdelest a60aa3d
Add _score use case
carlosdelest 63c62c7
Check knn usage in disjunctions for non pushable filters
carlosdelest 4440717
Rename
carlosdelest dee1e91
Move ReplaceKnnWithNoPushedDownFilters to logical optimizer
carlosdelest 6438bc1
Add tests
carlosdelest 21bb1f1
Fix knn refs
carlosdelest 376be41
Add tests
carlosdelest a24645d
capability bump
carlosdelest 87285f1
capability bump
carlosdelest aa89a4d
Don't expect blocks to be the first ones on score evaluators
carlosdelest beea012
Move around optimizer rules. Avoid doing optimization for invalid rul…
carlosdelest bf05ddd
Add CSV tests
carlosdelest 9e673f3
Register and fix ExactNN
carlosdelest 0ff8c23
Added a projection to get rid of extra columns
carlosdelest 521bff5
Spotless
carlosdelest 40fa387
Small docs change
carlosdelest 605f8b0
Merge remote-tracking branch 'origin/main' into non-issue/knn-prefilt…
carlosdelest b11c465
Spotless
carlosdelest e9d3ba1
Fix test
carlosdelest 8d8b7fb
Fix test
carlosdelest 5d96906
Merge remote-tracking branch 'origin/main' into non-issue/knn-prefilt…
carlosdelest 8f1fb3a
[CI] Auto commit changes from spotless
b132338
Fix test
carlosdelest 03d4c21
Merge remote-tracking branch 'carlosdelest/non-issue/knn-prefilter-no…
carlosdelest File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,6 @@ | |
|
||
import org.elasticsearch.compute.data.Block; | ||
import org.elasticsearch.compute.data.BlockFactory; | ||
import org.elasticsearch.compute.data.DocVector; | ||
import org.elasticsearch.compute.data.DoubleBlock; | ||
import org.elasticsearch.compute.data.DoubleVector; | ||
import org.elasticsearch.compute.data.Page; | ||
|
@@ -46,9 +45,9 @@ public ScoreOperator(BlockFactory blockFactory, ExpressionScorer scorer, int sco | |
|
||
@Override | ||
protected Page process(Page page) { | ||
assert page.getBlockCount() >= 2 : "Expected at least 2 blocks, got " + page.getBlockCount(); | ||
assert page.getBlock(0).asVector() instanceof DocVector : "Expected a DocVector, got " + page.getBlock(0).asVector(); | ||
assert page.getBlock(1).asVector() instanceof DoubleVector : "Expected a DoubleVector, got " + page.getBlock(1).asVector(); | ||
assert page.getBlockCount() > scoreBlockPosition : "Expected to get a score block in position " + scoreBlockPosition; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was an uncovered bug |
||
assert page.getBlock(scoreBlockPosition).asVector() instanceof DoubleVector | ||
: "Expected a DoubleVector as a score block, got " + page.getBlock(scoreBlockPosition).asVector(); | ||
|
||
Block[] blocks = new Block[page.getBlockCount()]; | ||
for (int i = 0; i < page.getBlockCount(); i++) { | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made
LuceneQueryEvaluator
more robust