-
Notifications
You must be signed in to change notification settings - Fork 25.6k
ESQL: Make field fusion generic #137382
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
Open
nik9000
wants to merge
16
commits into
elastic:main
Choose a base branch
from
nik9000:esql_fuse_length
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.
Open
ESQL: Make field fusion generic #137382
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
a3c526e
ESQL: Make field fusion generic
nik9000 7758ab9
Update docs/changelog/137382.yaml
nik9000 47c874e
[CI] Auto commit changes from spotless
6b0fead
More tests
nik9000 1dd6d96
Tests
nik9000 ce8e6aa
Merge remote-tracking branch 'nik9000/esql_fuse_length' into esql_fus…
nik9000 d50a74b
[CI] Auto commit changes from spotless
8746cfa
Add names back
nik9000 15eb5e9
Merge branch 'main' into esql_fuse_length
nik9000 d01184b
Renam
nik9000 d6897d8
[CI] Auto commit changes from spotless
e091312
Merge branch 'main' into esql_fuse_length
nik9000 538b72b
More tests
nik9000 2fc8fd5
Merge remote-tracking branch 'nik9000/esql_fuse_length' into esql_fus…
nik9000 e310d4b
[CI] Auto commit changes from spotless
bb81e43
Merge branch 'main' into esql_fuse_length
nik9000 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| pr: 137382 | ||
| summary: Make field fusion generic | ||
| area: ES|QL | ||
| type: enhancement | ||
| issues: [] |
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
42 changes: 42 additions & 0 deletions
42
...r/src/main/java/org/elasticsearch/index/mapper/blockloader/BlockLoaderFunctionConfig.java
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 |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the "Elastic License | ||
| * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
| * Public License v 1"; you may not use this file except in compliance with, at | ||
| * your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
| * License v3.0 only", or the "Server Side Public License, v 1". | ||
| */ | ||
|
|
||
| package org.elasticsearch.index.mapper.blockloader; | ||
|
|
||
| import org.elasticsearch.index.mapper.MappedFieldType; | ||
|
|
||
| /** | ||
| * Configuration needed to transform loaded values into blocks. | ||
| * {@link MappedFieldType}s will find me in | ||
| * {@link MappedFieldType.BlockLoaderContext#blockLoaderFunctionConfig()} and | ||
| * use this configuration to choose the appropriate implementation for | ||
| * transforming loaded values into blocks. | ||
| */ | ||
| public interface BlockLoaderFunctionConfig { | ||
| /** | ||
| * Name used in descriptions. | ||
| */ | ||
| String name(); | ||
|
|
||
| record Named(String name, Warnings warnings) implements BlockLoaderFunctionConfig { | ||
| @Override | ||
| public int hashCode() { | ||
| return name.hashCode(); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object o) { | ||
| if (o == null || getClass() != o.getClass()) { | ||
| return false; | ||
| } | ||
| Named named = (Named) o; | ||
| return name.equals(named.name); | ||
| } | ||
| } | ||
| } |
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
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
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
36 changes: 36 additions & 0 deletions
36
...l/src/main/java/org/elasticsearch/xpack/esql/expression/function/BlockLoaderWarnings.java
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 |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| package org.elasticsearch.xpack.esql.expression.function; | ||
|
|
||
| import org.elasticsearch.compute.operator.DriverContext; | ||
| import org.elasticsearch.compute.operator.Warnings; | ||
| import org.elasticsearch.xpack.esql.core.tree.Source; | ||
|
|
||
| public class BlockLoaderWarnings implements org.elasticsearch.index.mapper.blockloader.Warnings { | ||
|
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 guess these are warnings that can be created when using BlockLoader function config to load values. Should we add that to the javadoc? |
||
| private final DriverContext.WarningsMode warningsMode; | ||
| private final Source source; | ||
| private Warnings delegate; | ||
|
|
||
| public BlockLoaderWarnings(DriverContext.WarningsMode warningsMode, Source source) { | ||
| this.warningsMode = warningsMode; | ||
| this.source = source; | ||
| } | ||
|
|
||
| @Override | ||
| public void registerException(Class<? extends Exception> exceptionClass, String message) { | ||
| if (delegate == null) { | ||
| delegate = Warnings.createOnlyWarnings( | ||
| warningsMode, | ||
| source.source().getLineNumber(), | ||
| source.source().getColumnNumber(), | ||
| source.text() | ||
| ); | ||
| } | ||
| delegate.registerException(exceptionClass, message); | ||
| } | ||
| } | ||
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.
This bothers me. I needed this because without it we'd try to push this:
to the index. Now, we might be able to do that with a specialized lucene query. But we don't have one of those. Without those change instead what happens is:
LENGTH(kwd)becomes$$kwd$length$hash$.$$kwd$length$hash$ < 10as pushable.This tells us we can't push it. But it's kind of picky. If
SearchStatstookEsFieldit could check this easy enough. That might be a good solution to this.