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: GROUPing BY PI() arithmetic operation results in exception #41244

Closed
astefan opened this issue Apr 16, 2019 · 3 comments
Closed

SQL: GROUPing BY PI() arithmetic operation results in exception #41244

astefan opened this issue Apr 16, 2019 · 3 comments
Labels

Comments

@astefan
Copy link
Contributor

astefan commented Apr 16, 2019

sql> SELECT PI() + num0 AS x FROM "calcs" GROUP BY 1;
Server error [Server sent bad type [folding_exception]. Original type was [line 1:8: Cannot find grouping for 'PI() + num0']. [FoldingException[line 1:8: Cannot find grouping for 'PI() + num0']
        at org.elasticsearch.xpack.sql.planner.QueryFolder$FoldAggregate.rule(QueryFolder.java:319)
        at org.elasticsearch.xpack.sql.planner.QueryFolder$FoldAggregate.rule(QueryFolder.java:203)
        at org.elasticsearch.xpack.sql.tree.Node.lambda$transformUp$11(Node.java:196)
        at org.elasticsearch.xpack.sql.tree.Node.transformUp(Node.java:190)
        at org.elasticsearch.xpack.sql.tree.Node.transformUp(Node.java:196)
        at org.elasticsearch.xpack.sql.planner.QueryFolder$FoldingRule.apply(QueryFolder.java:586)
        at org.elasticsearch.xpack.sql.planner.QueryFolder$FoldingRule.apply(QueryFolder.java:582)
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search

@matriv matriv self-assigned this Apr 23, 2019
@matriv
Copy link
Contributor

matriv commented May 8, 2019

This is another bug related to the ExpressionIds similar to #33361 and #40240

The plan looks like:

AggregateExec[[Add[PI()=3.141592653589793,emp_no{f}#16]#30],[Add[PI()=3.141592653589793,emp_no{f}#16]#32 AS x#4]]

so one id is 30 and the other is 32 so it's not found in the map of the groupingContext.

@matriv
Copy link
Contributor

matriv commented May 9, 2019

Closing as a duplicate of #36074

@matriv matriv closed this as completed May 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants