-
Notifications
You must be signed in to change notification settings - Fork 25.4k
ESQL: Initial support for unmapped fields #119886
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
ESQL: Initial support for unmapped fields #119886
Conversation
5f04c1f
to
fd1abd0
Compare
Hi @GalLalouche, I've created a changelog YAML for you. |
Pinging @elastic/es-analytical-engine (Team:Analytics) |
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.
Heya! I only took a quick glance at this, but I noticed the following:
The new syntax and command are immediately released. Can we please hide this behind a SNAPSHOT-only? Otherwise it's gonna be made available in Serverless on the next rollout.Update: sorry, it's already hidden behind SNAPSHOT in the parser, so that's good.- I can see some unrelated parser files being changed (SQL, EQL, KQL and Painless). I guess these were accidentally changed due to regenerating the parsers? I'd like to exclude these from the PR, please.
If at all possible, it'd be great to include a csv test to showcase the functionality. Or a yaml test if csv tests are too inflexible. In case that'd blow the PR's scope because not all is in place to run the feature end-to-end, let's at least add a short javadoc to theUpdate: Sorry, you correctly added a csv-spec test which I missed.Insist
class to describe its purpose.
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java
Outdated
Show resolved
Hide resolved
...k/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/util/CollectionUtils.java
Outdated
Show resolved
Hide resolved
4289393
to
0ca5e79
Compare
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.
Some quick comments, without going deep with the code:
- disabling the _source should be covered so that whatever we do know should still happen after this PR
- excluding certain fields from _source behavior should also be kept as is. If we already have tests for this somewhere in yaml, csv or other IT tests, that's great and apologies for mentioning it.
- there is also the scenario where
index: false
anddoc_values: false
can be configured for a certain field. In this case, I guess this PR should address loading the value from_source
as well (if _source is available, of course, considering my previous two use cases)
He already LGTMed, but can't approve right now
@elasticsearchmachine run elasticsearch-ci/part-1 |
💔 Backport failed
You can use sqren/backport to manually backport by running |
private static void checkInsist(LogicalPlan p, Failures failures) { | ||
if (p instanceof Insist i) { | ||
LogicalPlan child = i.child(); | ||
if ((child instanceof EsRelation || child instanceof Insist) == false) { | ||
failures.add(fail(i, "[insist] can only be used after [from] or [insist] commands, but was [{}]", child.sourceText())); | ||
} | ||
} | ||
} | ||
|
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.
One more piece that could be refactored: have Insist
implement PostAnalysisVerificationAware
and move the check there.
Nit: I think we capitalise the commands elsewhere (including tests for this check), we should do the same here.
This PR adds initial support for unmapped fields, using the INSIST clause. For starters, this unmapped fields without a cast. Note that the INSIST keyword is potentially a placeholder, as the method of defining an unmapped field might change in the future, e.g., use a special magic function. As this is currently under development, the actual syntax is INSIST_🐔. First stage of elastic#120072. Specifically, the following features are implemented in this PR: * Support for INSIST keyword without a cast. In particular, if the type being INSISTed upon is mapped to anything other than KEYWORD, it will result in an InvalidMappedField. There is no support for union type resolution on top of INSIST. Future PRs will handle these conflicts. There is support for multiple parameters, or INSIST on top of INSIST which is equivalent. * Enforcing that INSIST must always be on top of a FROM or another INSIST. While this may change in the future, e.g., handling cases like `FROM foo | EVAL x = 1 | INSIST bar` will not be done in this PR, as it makes handling INSIST too complicated.
This PR adds initial support for unmapped fields, using the INSIST clause. For starters, this unmapped fields without a cast. Note that the INSIST keyword is potentially a placeholder, as the method of defining an unmapped field might change in the future, e.g., use a special magic function. As this is currently under development, the actual syntax is INSIST_🐔. First stage of elastic#120072. Specifically, the following features are implemented in this PR: * Support for INSIST keyword without a cast. In particular, if the type being INSISTed upon is mapped to anything other than KEYWORD, it will result in an InvalidMappedField. There is no support for union type resolution on top of INSIST. Future PRs will handle these conflicts. There is support for multiple parameters, or INSIST on top of INSIST which is equivalent. * Enforcing that INSIST must always be on top of a FROM or another INSIST. While this may change in the future, e.g., handling cases like `FROM foo | EVAL x = 1 | INSIST bar` will not be done in this PR, as it makes handling INSIST too complicated.
#121261, #122607) (#122805) * ESQL: Support for _index metadata field in CsvTests (#121261) * ESQL: Support for _index metadata field in CsvTests * Extract INDEX constant to MetadataAttribute * Add comment on capability * ESQL: Initial support for unmapped fields (#119886) This PR adds initial support for unmapped fields, using the INSIST clause. For starters, this unmapped fields without a cast. Note that the INSIST keyword is potentially a placeholder, as the method of defining an unmapped field might change in the future, e.g., use a special magic function. As this is currently under development, the actual syntax is INSIST_🐔. First stage of #120072. Specifically, the following features are implemented in this PR: * Support for INSIST keyword without a cast. In particular, if the type being INSISTed upon is mapped to anything other than KEYWORD, it will result in an InvalidMappedField. There is no support for union type resolution on top of INSIST. Future PRs will handle these conflicts. There is support for multiple parameters, or INSIST on top of INSIST which is equivalent. * Enforcing that INSIST must always be on top of a FROM or another INSIST. While this may change in the future, e.g., handling cases like `FROM foo | EVAL x = 1 | INSIST bar` will not be done in this PR, as it makes handling INSIST too complicated.
This PR adds initial support for unmapped fields, using the
INSIST
clause. For starters, this only support a single unmapped field, without casting. Casting may appear after theINSIST
clause, similar to union types.Note that the
INSIST
keyword is potentially a placeholder, as the method of defining an unmapped field might change in the future, e.g., use a special magic function.First stage of #120072.
Specifically, the following features are implemented in this PR:
INSIST
keyword and a single parameter without a cast. In particular, if the type beingINSIST
ed upon is mapped to anything other thanKEYWORD
, it will result in anInvalidMappedField
. There is no support for union type resolution on top ofINSIST
. Future PRs will handle these conflicts.INSIST
must always be on top of aFROM
. While this may change in the future, e.g., in cases likeFROM foo | EVAL x = 1 | INSIST bar
, it will not be done in this PR, as it makes handlingINSIST
too complicated.