Elasticsearch: SQL: Exception thrown for agg query with duplicate aliases

Created on 4 Jun 2020  路  7Comments  路  Source: elastic/elasticsearch

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
}
:Query LanguageSQL >bug QL

All 7 comments

Pinging @elastic/es-ql (:Query Languages/SQL)

Hi @matriv Shall i work on this issue ? This will be my first contribution . If not, please suggest me some open issues for me. Thanks in Advance.

@matriv, the issue doesn't reproduce for me neither in master, nor in 7.8.
Might have been fixed after reporting, but not sure if id'ing the fix and backporting to a pre 7.8 version would make sense anyways. So wanted to 2x check if closing it is OK.

@bpintea Probably it was fixed with #58399. I've checked the behaviour with the original version of the PR and was still there, but apparently the new approach fixed it. I doubled checked it too, so I think it's safe to close this.

@bpintea would you mind adding a test case for those please?

@bpintea would you mind adding a test case for those please?

Sure, can do.

Thx, and sorry I forgot to ask that before.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Praveen82 picture Praveen82  路  3Comments

clintongormley picture clintongormley  路  3Comments

jpountz picture jpountz  路  3Comments

clintongormley picture clintongormley  路  3Comments

ppf2 picture ppf2  路  3Comments