Skip to content

ES|QL: pushdown LOOKUP JOIN past SORT #121884

@luigidellaquila

Description

@luigidellaquila

(and potentially other commands)

Some queries cannot be executed due to unbounded sort.

Eg.

languages mapping:

{
  "mappings": {        
        "properties": {"language_code": {"type": "integer"}, "name": {"type": "keyword"}}}, "settings": {"index": {"mode": "lookup"}}
}
row language_code = 1, name = "foo" 
| sort name 
| lookup join languages on language_code 
| where name == "English"

will result in a verification_exception.

Some cases though, could be fixed by pushing LOOKUP JOIN past SORT.

When there is attribute masking it's particularly challenging, as we'll have to keep a copy of the original column with a different name and then discard it, eg. the above query could be translated to

row language_code = 1, name = "foo" 
| RENAME name AS $$name 
| lookup join languages on language_code 
| sort $$name 
| DROP $$name
| where name == "English"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions