Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix planner bug when mixing window functions and implicit coercions
A query that has: - window functions - implicit coercions - wildcard field references (e.g., SELECT *) Such as: SELECT *, 1.0 * count(*) OVER () FROM (VALUES 1); Fails during planning with the following error: java.lang.IllegalStateException: No mapping for field '0' at com.google.common.base.Preconditions.checkState(Preconditions.java:197) at com.facebook.presto.sql.planner.TranslationMap.rewrite(TranslationMap.java:114) at com.facebook.presto.sql.planner.PlanBuilder.rewrite(PlanBuilder.java:72) at com.facebook.presto.sql.planner.QueryPlanner.project(QueryPlanner.java:210) at com.facebook.presto.sql.planner.QueryPlanner.visitQuerySpecification(QueryPlanner.java:128) at com.facebook.presto.sql.planner.QueryPlanner.visitQuerySpecification(QueryPlanner.java:70) 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:416) at com.facebook.presto.sql.planner.RelationPlanner.visitQuerySpecification(RelationPlanner.java:97) 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:141) at com.facebook.presto.sql.planner.QueryPlanner.visitQuery(QueryPlanner.java:97) at com.facebook.presto.sql.planner.QueryPlanner.visitQuery(QueryPlanner.java:70) 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:403) at com.facebook.presto.sql.planner.RelationPlanner.visitQuery(RelationPlanner.java:97) 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:176) at com.facebook.presto.sql.planner.LogicalPlanner.plan(LogicalPlanner.java:80)
- Loading branch information