Skip to content

SQL: NPE with ORDER BY re-aliased reference from subquery #67237

Closed
@bpintea

Description

@bpintea

Ordering by a reference which itself points to an alias defined in a subquery will lead to a NPE:
SELECT g AS h FROM ( SELECT gender AS g FROM test_emp) ORDER BY h
will generate:

    "type" : "null_pointer_exception",
    "reason" : "Cannot invoke \"org.elasticsearch.xpack.ql.expression.Expression.hashCode()\" because \"e\" is null"

and grouping by it will raise:

    "type" : "sql_illegal_argument_exception",
    "reason" : "Cannot GROUP BY g{r}#18308"

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions