Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL: Wrong column name in case of a function without alias that has computable content #31869

Closed
astefan opened this issue Jul 6, 2018 · 1 comment

Comments

@astefan
Copy link
Contributor

astefan commented Jul 6, 2018

Best exemplified by an example: SELECT CHAR(emp_no % 10000) FROM "test_emp";
The result will have the column name CHAR(((emp_no{f}#14) % 10000)). It should be CHAR((emp_no % 10000)).

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search-aggs

@costin costin added the v6.5.0 label Sep 7, 2018
@matriv matriv self-assigned this Sep 7, 2018
matriv added a commit to matriv/elasticsearch that referenced this issue Sep 7, 2018
Previously, When an arithmetic function is applied on a
table column in the `SELECT` clause the name of the result
column name contained weird characters used internally when
processing the SQL statement. E.g.:

  SELECT CHAR(emp_no % 10000) FROM "test_emp"

returned:

  CHAR((emp_no{f}elastic#14) % 10000))

as the column name instead of:

  CHAR((emp_no) % 10000))

Fixes: elastic#31869
matriv pushed a commit that referenced this issue Sep 10, 2018
Previously, when an arithmetic function got applied on a
table column in the `SELECT` clause, the name of the result
column contained weird characters used internally when
processing the SQL statement e.g.:

  SELECT CHAR(emp_no % 10000) FROM "test_emp"

returned:

  CHAR((emp_no{f}#14) % 10000))

as the column name instead of:

  CHAR((emp_no) % 10000))

Also, fix an issue that causes a ClassCastException to be thrown
when using functions where both arguments are literals.

Closes #31869
Closes #33461
matriv pushed a commit that referenced this issue Sep 10, 2018
Previously, when an arithmetic function got applied on a
table column in the `SELECT` clause, the name of the result
column contained weird characters used internally when
processing the SQL statement e.g.:

  SELECT CHAR(emp_no % 10000) FROM "test_emp"

returned:

  CHAR((emp_no{f}#14) % 10000))

as the column name instead of:

  CHAR((emp_no) % 10000))

Also, fix an issue that causes a ClassCastException to be thrown
when using functions where both arguments are literals.

Closes #31869
Closes #33461
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants