Skip to content

ES|QL: improper pruning of unused columns at planning time #126017

@luigidellaquila

Description

@luigidellaquila

With the CSV dataset

from sample_data  
| eval type = 1000 
| lookup join message_types_lookup on message 
| grok type "%{WORD:foo}" 
| keep event_duration, type
{
    "took": 39,
    "is_partial": false,
    "columns": [
        {
            "name": "event_duration",
            "type": "long"
        },
        {
            "name": "type",
            "type": "keyword"
        }
    ],
    "values": [
   ....
]

type (a keyword) comes from the right-hand side of the JOIN, and overwrites the previous integer type column.

Removing it from the final projections also removes it from the output of the JOIN, no longer masking the existing integer column:

from sample_data  
| eval type = 1000 
| lookup join message_types_lookup on message 
| grok type "%{WORD:foo}" 
| keep event_duration
{
    "error": {
        "root_cause": [
            {
                "type": "verification_exception",
                "reason": "Found 1 problem\nline 1:91: Grok only supports KEYWORD or TEXT values, found expression [type] type [INTEGER]"
            }
        ],
        "type": "verification_exception",
        "reason": "Found 1 problem\nline 1:91: Grok only supports KEYWORD or TEXT values, found expression [type] type [INTEGER]"
    },
    "status": 400
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions