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

Propagate RelCollation on aliased columns in JoinRule

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.1.0-incubating
    • None

    Description

      Consider this query:

      SELECT *
      FROM emp JOIN dept ON emp.deptno = dept.deptno
      ORDER BY dept.deptno;

      If table emp is sorted on emp.deptno (for example, table emp has index on emp.deptno, or table emp comes from a subquery which sorts on emp.deptno), the join predicate emp.deptno = dept.deptno indicates the two columns are aliased columns in terms of ordering. If JoinRule keep track of the RelCollation trait for the aliased columns, the query essentially become as following

      SELECT *
      FROM emp JOIN dept ON emp.deptno = dept.deptno
      ORDER BY emp.deptno;

      The ORDER BY should not require a SortRel, since the input table emp is sorted on emp.depno.

      Currently, optiq framework does not recognize the aliased columns from join = predicates, and may introduce redundant sort to the plan.

      This issue is relevant to issue (#41 | CALCITE-41)
      https://github.com/julianhyde/optiq/issues/41

      ---------------- Imported from GitHub ----------------
      Url: https://github.com/julianhyde/optiq/issues/254
      Created by: jinfengni
      Labels:
      Created at: Thu Apr 17 22:53:46 CEST 2014
      State: open

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            github-import GitHub Import
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment