-
Notifications
You must be signed in to change notification settings - Fork 25.6k
ESQL: Compute engine support for tagged queries #128521
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
Changes from 4 commits
17c1eac
aaa002b
229e253
fc142df
c048c17
303359d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -97,7 +97,7 @@ public abstract static class Factory implements SourceOperator.SourceOperatorFac | |
| */ | ||
| protected Factory( | ||
| List<? extends ShardContext> contexts, | ||
| Function<ShardContext, Query> queryFunction, | ||
| Function<ShardContext, List<LuceneSliceQueue.QueryAndTags>> queryFunction, | ||
| DataPartitioning dataPartitioning, | ||
| Function<Query, LuceneSliceQueue.PartitioningStrategy> autoStrategy, | ||
| int taskConcurrency, | ||
|
|
@@ -155,10 +155,13 @@ LuceneScorer getCurrentOrLoadNextScorer() { | |
| final PartialLeafReaderContext partialLeaf = currentSlice.getLeaf(sliceIndex++); | ||
| logger.trace("Starting {}", partialLeaf); | ||
| final LeafReaderContext leaf = partialLeaf.leafReaderContext(); | ||
| if (currentScorer == null || currentScorer.leafReaderContext() != leaf) { | ||
| if (currentScorer == null // First time | ||
| || currentScorer.leafReaderContext() != leaf // Moved to a new leaf | ||
| || currentScorer.weight != currentSlice.weight() // Moved to a new query | ||
|
Member
Author
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 last bit of the |
||
| ) { | ||
| final Weight weight = currentSlice.weight(); | ||
| processedQueries.add(weight.getQuery()); | ||
| currentScorer = new LuceneScorer(currentSlice.shardContext(), weight, leaf); | ||
| currentScorer = new LuceneScorer(currentSlice.shardContext(), weight, currentSlice.tags(), leaf); | ||
| } | ||
| assert currentScorer.maxPosition <= partialLeaf.maxDoc() : currentScorer.maxPosition + ">" + partialLeaf.maxDoc(); | ||
| currentScorer.maxPosition = partialLeaf.maxDoc(); | ||
|
|
@@ -177,15 +180,17 @@ static final class LuceneScorer { | |
| private final ShardContext shardContext; | ||
| private final Weight weight; | ||
| private final LeafReaderContext leafReaderContext; | ||
| private final List<Object> tags; | ||
|
|
||
| private BulkScorer bulkScorer; | ||
| private int position; | ||
| private int maxPosition; | ||
| private Thread executingThread; | ||
|
|
||
| LuceneScorer(ShardContext shardContext, Weight weight, LeafReaderContext leafReaderContext) { | ||
| LuceneScorer(ShardContext shardContext, Weight weight, List<Object> tags, LeafReaderContext leafReaderContext) { | ||
| this.shardContext = shardContext; | ||
| this.weight = weight; | ||
| this.tags = tags; | ||
| this.leafReaderContext = leafReaderContext; | ||
| reinitialize(); | ||
| } | ||
|
|
@@ -230,6 +235,13 @@ Weight weight() { | |
| int position() { | ||
| return position; | ||
| } | ||
|
|
||
| /** | ||
| * Tags to add to the data returned by this query. | ||
| */ | ||
| List<Object> tags() { | ||
|
Member
Author
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. I'm not entirely sure
Member
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. Yes, the object list can provide a better debugging message, but the block supplier might be better; otherwise, we would need to provide the exact boxed type for numeric values.
Member
Author
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. Yeah, the getting the boxed type perfect could be tricky. Suppliers are quite explicit. Let's keep it as is for now and rework when we find a rough edge. |
||
| return tags; | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
|
|
||
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.
I think we can leverage this and min/max later too.
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.
++