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

Planning failure for group by query with field dereference #3823

Closed
martint opened this issue Oct 24, 2015 · 2 comments
Closed

Planning failure for group by query with field dereference #3823

martint opened this issue Oct 24, 2015 · 2 comments
Assignees
Labels

Comments

@martint
Copy link
Contributor

martint commented Oct 24, 2015

Given a table with the following shape:

t (
   x array<row(key varchar, value bigint)>
)

This query:

SELECT x[1].key, count(1) 
FROM t 
GROUP BY 1 
ORDER BY 2

Fails with:

java.lang.IllegalArgumentException: No mapping for expression: "x"[1]."key"
    at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145)
    at com.facebook.presto.sql.planner.TranslationMap.get(TranslationMap.java:153)
    at com.facebook.presto.sql.planner.TranslationMap.get(TranslationMap.java:165)
    at com.facebook.presto.sql.planner.PlanBuilder.translate(PlanBuilder.java:63)
    at com.facebook.presto.sql.planner.QueryPlanner.aggregate(QueryPlanner.java:386)
    at com.facebook.presto.sql.planner.QueryPlanner.visitQuerySpecification(QueryPlanner.java:131)
    at com.facebook.presto.sql.planner.QueryPlanner.visitQuerySpecification(QueryPlanner.java:80)
    at com.facebook.presto.sql.tree.QuerySpecification.accept(QuerySpecification.java:98)
    at com.facebook.presto.sql.tree.AstVisitor.process(AstVisitor.java:22)
    at com.facebook.presto.sql.planner.RelationPlanner.visitQuerySpecification(RelationPlanner.java:394)
    at com.facebook.presto.sql.planner.RelationPlanner.visitQuerySpecification(RelationPlanner.java:94)
    at com.facebook.presto.sql.tree.QuerySpecification.accept(QuerySpecification.java:98)
    at com.facebook.presto.sql.tree.AstVisitor.process(AstVisitor.java:22)
    at com.facebook.presto.sql.planner.QueryPlanner.planQueryBody(QueryPlanner.java:151)
    at com.facebook.presto.sql.planner.QueryPlanner.visitQuery(QueryPlanner.java:107)
    at com.facebook.presto.sql.planner.QueryPlanner.visitQuery(QueryPlanner.java:80)
    at com.facebook.presto.sql.tree.Query.accept(Query.java:80)
    at com.facebook.presto.sql.tree.AstVisitor.process(AstVisitor.java:22)
    at com.facebook.presto.sql.planner.RelationPlanner.visitQuery(RelationPlanner.java:381)
    at com.facebook.presto.sql.planner.RelationPlanner.visitQuery(RelationPlanner.java:94)
    at com.facebook.presto.sql.tree.Query.accept(Query.java:80)
    at com.facebook.presto.sql.tree.AstVisitor.process(AstVisitor.java:22)
    at com.facebook.presto.sql.planner.LogicalPlanner.createRelationPlan(LogicalPlanner.java:204)
    at com.facebook.presto.sql.planner.LogicalPlanner.plan(LogicalPlanner.java:89)
    at com.facebook.presto.execution.SqlQueryExecution.doAnalyzeQuery(SqlQueryExecution.java:266)
    at com.facebook.presto.execution.SqlQueryExecution.analyzeQuery(SqlQueryExecution.java:245)
    at com.facebook.presto.execution.SqlQueryExecution.start(SqlQueryExecution.java:209)
    at com.facebook.presto.execution.QueuedExecution.lambda$start$171(QueuedExecution.java:68)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

If key is no de-referenced, the query works fine. This works on version 0.123, so this could be related to the changes in db5ea91

@cberner
Copy link
Contributor

cberner commented Oct 24, 2015

@joy-yao was looking into this

On Sat, Oct 24, 2015, 10:46 AM Martin Traverso notifications@github.com
wrote:

Given a table with the following shape:

t (
x array<row(key varchar, value bigint)>
)

This query:

SELECT x[1].key, count(1)
FROM t
GROUP BY 1
ORDER BY 2

Fails with:

java.lang.IllegalArgumentException: No mapping for expression: "x"[1]."key"
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145)
at com.facebook.presto.sql.planner.TranslationMap.get(TranslationMap.java:153)
at com.facebook.presto.sql.planner.TranslationMap.get(TranslationMap.java:165)
at com.facebook.presto.sql.planner.PlanBuilder.translate(PlanBuilder.java:63)
at com.facebook.presto.sql.planner.QueryPlanner.aggregate(QueryPlanner.java:386)
at com.facebook.presto.sql.planner.QueryPlanner.visitQuerySpecification(QueryPlanner.java:131)
at com.facebook.presto.sql.planner.QueryPlanner.visitQuerySpecification(QueryPlanner.java:80)
at com.facebook.presto.sql.tree.QuerySpecification.accept(QuerySpecification.java:98)
at com.facebook.presto.sql.tree.AstVisitor.process(AstVisitor.java:22)
at com.facebook.presto.sql.planner.RelationPlanner.visitQuerySpecification(RelationPlanner.java:394)
at com.facebook.presto.sql.planner.RelationPlanner.visitQuerySpecification(RelationPlanner.java:94)
at com.facebook.presto.sql.tree.QuerySpecification.accept(QuerySpecification.java:98)
at com.facebook.presto.sql.tree.AstVisitor.process(AstVisitor.java:22)
at com.facebook.presto.sql.planner.QueryPlanner.planQueryBody(QueryPlanner.java:151)
at com.facebook.presto.sql.planner.QueryPlanner.visitQuery(QueryPlanner.java:107)
at com.facebook.presto.sql.planner.QueryPlanner.visitQuery(QueryPlanner.java:80)
at com.facebook.presto.sql.tree.Query.accept(Query.java:80)
at com.facebook.presto.sql.tree.AstVisitor.process(AstVisitor.java:22)
at com.facebook.presto.sql.planner.RelationPlanner.visitQuery(RelationPlanner.java:381)
at com.facebook.presto.sql.planner.RelationPlanner.visitQuery(RelationPlanner.java:94)
at com.facebook.presto.sql.tree.Query.accept(Query.java:80)
at com.facebook.presto.sql.tree.AstVisitor.process(AstVisitor.java:22)
at com.facebook.presto.sql.planner.LogicalPlanner.createRelationPlan(LogicalPlanner.java:204)
at com.facebook.presto.sql.planner.LogicalPlanner.plan(LogicalPlanner.java:89)
at com.facebook.presto.execution.SqlQueryExecution.doAnalyzeQuery(SqlQueryExecution.java:266)
at com.facebook.presto.execution.SqlQueryExecution.analyzeQuery(SqlQueryExecution.java:245)
at com.facebook.presto.execution.SqlQueryExecution.start(SqlQueryExecution.java:209)
at com.facebook.presto.execution.QueuedExecution.lambda$start$171(QueuedExecution.java:68)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

If key is no de-referenced, the query works fine. This works on version
0.123, so this could be related to the changes in db5ea91
db5ea91


Reply to this email directly or view it on GitHub
#3823.

@raghavsethi
Copy link
Contributor

@joy-yao fixed this in #3830.

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

4 participants