Skip to content

Conversation

@alex-spies
Copy link
Contributor

Fix #129561

#127009 fixed wrong field caps requests in cases where wildcard patterns were used in DROP. However, it also caused #129561 because in EsqlSession#fieldNames, it kept track of the DROP wildcard patterns together with all the references/patterns used in KEEP commands; the latter are used to decide whether or not we need to ask for just * or for more specific fields/patterns from a lookup index. (KEEP after LOOKUP JOIN -> specific fields, otherwise ask for *)

In EsqlSession#fieldNames, keep track of wildcard patterns in DROP separately from the references and wildcard patterns in KEEP commands.

In EsqlSession#fieldNames, keep track of wildcard patterns in DROP
separately from the references and wildcard patterns in KEEP commands.

If the latter are present after a LOOKUP JOIN, we'll ask fieldcaps for
specific fields of the lookup index, whereas `DROP somefield*` should
not trigger asking for specific fields by itself - if there's no
downstream KEEP, we still need to ask for `*`.
@elasticsearchmachine
Copy link
Collaborator

Hi @alex-spies, I've created a changelog YAML for you.

@alex-spies
Copy link
Contributor Author

alex-spies commented Jul 2, 2025

TODO:

@alex-spies alex-spies added v8.18.4 auto-backport Automatically create backport pull requests when merged labels Jul 3, 2025
@alex-spies alex-spies marked this pull request as ready for review July 3, 2025 11:53
@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Jul 3, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

Copy link
Contributor

@astefan astefan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alex-spies alex-spies changed the title ESQL: Fix wildcard drop after lookup join ESQL: Fix wildcard DROP after LOOKUP JOIN Jul 7, 2025
@alex-spies alex-spies merged commit 05fc6f2 into elastic:main Jul 7, 2025
32 checks passed
@alex-spies alex-spies deleted the fix-keep-before-lu-join branch July 7, 2025 07:11
alex-spies added a commit to alex-spies/elasticsearch that referenced this pull request Jul 7, 2025
In EsqlSession#fieldNames, keep track of wildcard patterns in DROP
separately from the references and wildcard patterns in KEEP commands.

Only the latter are relevant to determine if we need to ask for all fields for the
lookup index in the field caps request.
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
8.19 Commit could not be cherrypicked due to conflicts
9.1
9.0 Commit could not be cherrypicked due to conflicts
8.18 Commit could not be cherrypicked due to conflicts

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 130448

elasticsearchmachine pushed a commit that referenced this pull request Jul 7, 2025
In EsqlSession#fieldNames, keep track of wildcard patterns in DROP
separately from the references and wildcard patterns in KEEP commands.

Only the latter are relevant to determine if we need to ask for all fields for the
lookup index in the field caps request.
alex-spies added a commit to alex-spies/elasticsearch that referenced this pull request Jul 7, 2025
In EsqlSession#fieldNames, keep track of wildcard patterns in DROP
separately from the references and wildcard patterns in KEEP commands.

Only the latter are relevant to determine if we need to ask for all fields for the
lookup index in the field caps request.

(cherry picked from commit 05fc6f2)

# Conflicts:
#	x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java
#	x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/session/IndexResolverFieldNamesTests.java
alex-spies added a commit to alex-spies/elasticsearch that referenced this pull request Jul 7, 2025
In EsqlSession#fieldNames, keep track of wildcard patterns in DROP
separately from the references and wildcard patterns in KEEP commands.

Only the latter are relevant to determine if we need to ask for all fields for the
lookup index in the field caps request.

(cherry picked from commit 05fc6f2)

# Conflicts:
#	x-pack/plugin/esql/qa/testFixtures/src/main/resources/lookup-join.csv-spec
#	x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java
#	x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/session/IndexResolverFieldNamesTests.java
@alex-spies
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
9.0
8.19
8.18

Questions ?

Please refer to the Backport tool documentation

alex-spies added a commit to alex-spies/elasticsearch that referenced this pull request Jul 7, 2025
In EsqlSession#fieldNames, keep track of wildcard patterns in DROP
separately from the references and wildcard patterns in KEEP commands.

Only the latter are relevant to determine if we need to ask for all fields for the
lookup index in the field caps request.

(cherry picked from commit 05fc6f2)

# Conflicts:
#	x-pack/plugin/esql/qa/testFixtures/src/main/resources/lookup-join.csv-spec
#	x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java
#	x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/session/EsqlSession.java
#	x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/session/IndexResolverFieldNamesTests.java
elasticsearchmachine pushed a commit that referenced this pull request Jul 7, 2025
In EsqlSession#fieldNames, keep track of wildcard patterns in DROP
separately from the references and wildcard patterns in KEEP commands.

Only the latter are relevant to determine if we need to ask for all fields for the
lookup index in the field caps request.

(cherry picked from commit 05fc6f2)

# Conflicts:
#	x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java
#	x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/session/IndexResolverFieldNamesTests.java
elasticsearchmachine pushed a commit that referenced this pull request Jul 7, 2025
In EsqlSession#fieldNames, keep track of wildcard patterns in DROP
separately from the references and wildcard patterns in KEEP commands.

Only the latter are relevant to determine if we need to ask for all fields for the
lookup index in the field caps request.

(cherry picked from commit 05fc6f2)

# Conflicts:
#	x-pack/plugin/esql/qa/testFixtures/src/main/resources/lookup-join.csv-spec
#	x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java
#	x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/session/IndexResolverFieldNamesTests.java
elasticsearchmachine pushed a commit that referenced this pull request Jul 7, 2025
* ESQL: Fix wildcard DROP after LOOKUP JOIN (#130448)

In EsqlSession#fieldNames, keep track of wildcard patterns in DROP
separately from the references and wildcard patterns in KEEP commands.

Only the latter are relevant to determine if we need to ask for all fields for the
lookup index in the field caps request.

(cherry picked from commit 05fc6f2)

# Conflicts:
#	x-pack/plugin/esql/qa/testFixtures/src/main/resources/lookup-join.csv-spec
#	x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java
#	x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/session/EsqlSession.java
#	x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/session/IndexResolverFieldNamesTests.java

* [CI] Auto commit changes from spotless

---------

Co-authored-by: elasticsearchmachine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Analytics/ES|QL AKA ESQL auto-backport Automatically create backport pull requests when merged backport pending >bug Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v8.18.4 v8.19.0 v9.0.4 v9.1.0 v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ES|QL: missing columns for wildcard drop after lookup join

3 participants