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: a histogram of histogram generates an incorrect error message #38308

Closed
astefan opened this issue Feb 4, 2019 · 1 comment · Fixed by #38649
Closed

SQL: a histogram of histogram generates an incorrect error message #38308

astefan opened this issue Feb 4, 2019 · 1 comment · Fixed by #38649

Comments

@astefan
Copy link
Contributor

astefan commented Feb 4, 2019

While a HISTOGRAM shouldn't be possible to be used inside another HISTOGRAM, the following test throws an exception that shouldn't be thrown at that path in code, but sooner than that. And it should be a different exception.

sql> select histogram(histogram("@timestamp", interval 1 minute), interval 1 minute) as h from test group by h;
Server error [Server encountered an error [Grouping functions cannot be scripted]. [SqlIllegalArgumentException[Grouping functions cannot be scripted]
        at org.elasticsearch.xpack.sql.expression.function.grouping.GroupingFunction.asScript(GroupingFunction.java:68)
        at org.elasticsearch.xpack.sql.planner.QueryTranslator.groupBy(QueryTranslator.java:299)
        at org.elasticsearch.xpack.sql.planner.QueryFolder$FoldAggregate.rule(QueryFolder.java:215)
        at org.elasticsearch.xpack.sql.planner.QueryFolder$FoldAggregate.rule(QueryFolder.java:205)
        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:582)
        at org.elasticsearch.xpack.sql.planner.QueryFolder$FoldingRule.apply(QueryFolder.java:578)
        at org.elasticsearch.xpack.sql.rule.RuleExecutor$Transformation.<init>(RuleExecutor.java:82)
        at org.elasticsearch.xpack.sql.rule.RuleExecutor.executeWithInfo(RuleExecutor.java:158)
        at org.elasticsearch.xpack.sql.rule.RuleExecutor.execute(RuleExecutor.java:130)
        at org.elasticsearch.xpack.sql.planner.QueryFolder.fold(QueryFolder.java:86)
        at org.elasticsearch.xpack.sql.planner.Planner.foldPlan(Planner.java:38)
        at org.elasticsearch.xpack.sql.planner.Planner.plan(Planner.java:28)
        at org.elasticsearch.xpack.sql.session.SqlSession.lambda$physicalPlan$4(SqlSession.java:156)
        at org.elasticsearch.action.ActionListener$1.onResponse(ActionListener.java:61)
        at org.elasticsearch.xpack.sql.session.SqlSession.lambda$optimizedPlan$3(SqlSession.java:152)
        at org.elasticsearch.action.ActionListener$1.onResponse(ActionListener.java:61)
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search

@jasontedor jasontedor added v8.0.0 and removed v7.0.0 labels Feb 6, 2019
costin added a commit to costin/elasticsearch that referenced this issue Feb 8, 2019
Improve verifier to disallow grouping over grouping functions (e.g.
HISTOGRAM over HISTOGRAM).

Close elastic#38308
@costin costin added the v6.7.0 label Feb 8, 2019
costin added a commit that referenced this issue Feb 9, 2019
Improve verifier to disallow grouping over grouping functions (e.g.
HISTOGRAM over HISTOGRAM).

Close #38308
costin added a commit that referenced this issue Feb 9, 2019
Improve verifier to disallow grouping over grouping functions (e.g.
HISTOGRAM over HISTOGRAM).

Close #38308

(cherry picked from commit 4e9b1cf)
costin added a commit that referenced this issue Feb 9, 2019
Improve verifier to disallow grouping over grouping functions (e.g.
HISTOGRAM over HISTOGRAM).

Close #38308

(cherry picked from commit 4e9b1cf)
(cherry picked from commit 794ee4f)
costin added a commit that referenced this issue Feb 9, 2019
Improve verifier to disallow grouping over grouping functions (e.g.
HISTOGRAM over HISTOGRAM).

Close #38308

(cherry picked from commit 4e9b1cf)
(cherry picked from commit 794ee4f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants