Skip to content

SQL: Exception thrown for agg query with duplicate aliases #57668

@matriv

Description

@matriv

There is an issue when you have duplicate aliases and using numeric references or the initial column names:

SELECT emp_no % languages as a, gender as a, max(salary) as a FROM test_emp GROUP BY 1, 2

or

SELECT emp_no % languages as a, gender as a, max(salary) as a FROM test_emp GROUP BY emp_no % languages, gender

both return an error like the following:

{
    "error": {
        "root_cause": [
            {
                "type": "sql_illegal_argument_exception",
                "reason": "Cannot resolve field extractor index for column [a{r}#121]"
            }
        ],
        "type": "sql_illegal_argument_exception",
        "reason": "Cannot resolve field extractor index for column [a{r}#121]"
    },
    "status": 500
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions