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

RelBuilder should simplify plan by pruning unused measures

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.36.0
    • None

    Description

      If you have a test like the following (modified from SqlToRelConverterTest#testMeasureRef)

          final String sql = "select deptno as c\n"
              + "from empm\n"
              + "group by deptno";
          fixture()
              .withFactory(c ->
                  c.withOperatorTable(t ->
                      SqlValidatorTest.operatorTableFor(SqlLibrary.CALCITE)))
              .withCatalogReader(MockCatalogReaderExtended::create)
              .withSql(sql)
              .ok();
      

      The expected results should look something like:

      LogicalAggregate(group=[{0}])
        LogicalProject(C=[$7])
          LogicalTableScan(table=[[CATALOG, SALES, EMPM]])
      

      Instead it looks like:

      LogicalAggregate(group=[{0}])
        LogicalProject(C=[$7], COUNT_PLUS_100=[$9], COUNT_TIMES_100=[$10])
          LogicalTableScan(table=[[CATALOG, SALES, EMPM]])
      

      I believe this is due to commit 568ce12.

      In essence, the measures should not be added to the projects unless necessary.

      Attachments

        Issue Links

        Activity

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

          People

            tanclary Tanner Clary
            tanclary Tanner Clary
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment