Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-3387

Query with GROUP BY and JOIN ... USING wrongly fails with "Column 'DEPTNO' is ambiguous" error

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.22.0
    • Component/s: None

      Description

      Query with GROUP BY and JOIN ... USING wrongly fails with "Column 'DEPTNO' is ambiguous" error. Here is the query:

      select deptno, count(*)
      from emp
      join dept using (deptno)
      group by deptno;
      

      Because of USING, the two deptno fields should be merged into one, and therefore deptno is not ambiguous. That query works in Oracle. Also note that

      select deptno
      from emp
      join dept using (deptno)
      

      works correctly in Calcite, and has since CALCITE-2227 was fixed.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Chunwei Lei Chunwei Lei
                Reporter:
                julianhyde Julian Hyde
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2h 20m
                  2h 20m