Uploaded image for project: 'Tajo'
  1. Tajo
  2. TAJO-716

Using column names actually aliased in aggregation functions can cause planning error.

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.8.0, 0.9.0
    • Fix Version/s: 0.8.0, 0.9.0
    • Component/s: Planner/Optimizer
    • Labels:
      None

      Description

      The below query can cause the following error.

      select
        nation.n_nationkey as n_nationkey,
        customer.c_name as c_name,
        count(nation.n_nationkey) as cnt
      from
        nation inner join customer on n_nationkey = c_nationkey
      group by
        nation.n_nationkey,
        customer.c_name
      order by
        n_nationkey, c_name;
      
      Stack Trace:
      org.apache.tajo.engine.planner.PlanningException: Cannot expect a referenced relation: n_nationkey (INT4)
      	at org.apache.tajo.engine.planner.logical.join.JoinGraph.guessRelationsFromJoinQual(JoinGraph.java:59)
      	at org.apache.tajo.engine.planner.logical.join.JoinGraph.addJoin(JoinGraph.java:92)
      	at org.apache.tajo.engine.planner.LogicalOptimizer$JoinGraphBuilder.visitJoin(LogicalOptimizer.java:165)
      	at org.apache.tajo.engine.planner.LogicalOptimizer$JoinGraphBuilder.visitJoin(LogicalOptimizer.java:133)
      	at org.apache.tajo.engine.planner.BasicLogicalPlanVisitor.visit(BasicLogicalPlanVisitor.java:81)
      	at org.apache.tajo.engine.planner.BasicLogicalPlanVisitor.visitGroupBy(BasicLogicalPlanVisitor.java:176)
      	at org.apache.tajo.engine.planner.BasicLogicalPlanVisitor.visit(BasicLogicalPlanVisitor.java:75)
      	at org.apache.tajo.engine.planner.BasicLogicalPlanVisitor.visitSort(BasicLogicalPlanVisitor.java:158)
      	at org.apache.tajo.engine.planner.BasicLogicalPlanVisitor.visit(BasicLogicalPlanVisitor.java:69)
      	at org.apache.tajo.engine.planner.BasicLogicalPlanVisitor.visitProjection(BasicLogicalPlanVisitor.java:140)
      	at org.apache.tajo.engine.planner.BasicLogicalPlanVisitor.visit(BasicLogicalPlanVisitor.java:63)
      	at org.apache.tajo.engine.planner.BasicLogicalPlanVisitor.visitRoot(BasicLogicalPlanVisitor.java:130)
      	at org.apache.tajo.engine.planner.BasicLogicalPlanVisitor.visit(BasicLogicalPlanVisitor.java:58)
      	at org.apache.tajo.engine.planner.BasicLogicalPlanVisitor.visit(BasicLogicalPlanVisitor.java:45)
      	at org.apache.tajo.engine.planner.LogicalOptimizer$JoinGraphBuilder.buildJoinGraph(LogicalOptimizer.java:148)
      	at org.apache.tajo.engine.planner.LogicalOptimizer.optimizeJoinOrder(LogicalOptimizer.java:86)
      	at org.apache.tajo.engine.planner.LogicalOptimizer.optimize(LogicalOptimizer.java:71)
      	at org.apache.tajo.master.GlobalEngine.createLogicalPlan(GlobalEngine.java:260)
      	at org.apache.tajo.master.GlobalEngine.executeQuery(GlobalEngine.java:138)
      

        Attachments

        1. TAJO-716.patch
          15 kB
          Hyunsik Choi

          Activity

            People

            • Assignee:
              hyunsik Hyunsik Choi
              Reporter:
              hyunsik Hyunsik Choi
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: