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

Enable AggregateProjectMergeRule in standard rule set

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.3.0-incubating
    • Component/s: None
    • Labels:
      None

      Description

      If you have a simple Project that just re-orders or renames fields, or projects a subset, and it is directly beneath an Aggregate, then the Aggregate can be rewritten in terms of the Project's input.

      This rule should also apply if the project computes expressions, if those expressions are not used.

      This rule will help AggegateJoinTransposeRule apply in more cases. For example, it cannot currently apply to

      select distinct dept.deptno from emp join dept using (deptno)

      because the join projects 2 columns and the aggregate only uses one.

        Issue Links

          Activity

          Hide
          julianhyde Julian Hyde added a comment -

          Resolved in release 1.3.0-incubating (2015-05-30).

          Show
          julianhyde Julian Hyde added a comment - Resolved in release 1.3.0-incubating (2015-05-30).
          Show
          julianhyde Julian Hyde added a comment - Fixed in http://git-wip-us.apache.org/repos/asf/incubator-calcite/commit/8276f258 .
          Hide
          julianhyde Julian Hyde added a comment -

          Agreed. I've changed the summary.

          Show
          julianhyde Julian Hyde added a comment - Agreed. I've changed the summary.
          Hide
          jcamachorodriguez Jesus Camacho Rodriguez added a comment -

          LGTM, probably the JIRA topic could be changed as the patch ends up fixing many different issues.

          Show
          jcamachorodriguez Jesus Camacho Rodriguez added a comment - LGTM, probably the JIRA topic could be changed as the patch ends up fixing many different issues.
          Show
          julianhyde Julian Hyde added a comment - Work in progress on https://github.com/julianhyde/incubator-calcite/tree/675-aggregate-project .
          Hide
          julianhyde Julian Hyde added a comment -

          Jesus Camacho Rodriguez, You're right. AggregateProjectMergeRule is precisely what we need. Didn't realize.

          However, I tried enabling it and it surfaced issues in AggregateJoinTransposeRule (see CALCITE-676) and AggregateRemoveRule.

          So, we have some work to do to enable it. Leaving this issue open.

          Show
          julianhyde Julian Hyde added a comment - Jesus Camacho Rodriguez , You're right. AggregateProjectMergeRule is precisely what we need. Didn't realize. However, I tried enabling it and it surfaced issues in AggregateJoinTransposeRule (see CALCITE-676 ) and AggregateRemoveRule. So, we have some work to do to enable it. Leaving this issue open.
          Hide
          jcamachorodriguez Jesus Camacho Rodriguez added a comment -

          Julian Hyde, isn't this what AggregateProjectMergeRule do? Or you have something else in mind?

          Show
          jcamachorodriguez Jesus Camacho Rodriguez added a comment - Julian Hyde , isn't this what AggregateProjectMergeRule do? Or you have something else in mind?

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Development