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

Expand SubstitutionVisitor of Aggregate with max/min, which column is the group by list of target

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • None
    • None
    • core

    Description

      Now, SubstitutionVisitor support `Query with distinct aggregate on the column is matched to the group list existing in target`, as CALCITE-4374 describes.

      But. It's fail, when query aggregate with max/min based on the column, which is in the group by list of target.

      Materialized view recognition should also success.

      //代码占位符
      @Test void testQueryNoDistinctOptionalityAggCallColInTargetGroupBy1() {
        final String mv = ""
            + "select \"name\", \"deptno\" "
            + "from \"emps\" group by \"name\", \"deptno\"";
        final String query = ""
            + "select \"name\", min(\"deptno\")\n"
            + "from \"emps\" group by \"name\"";
        sql(mv, query).ok();
      }
      

      Attachments

        1. image-2021-10-08-18-48-56-093.png
          39 kB
          Xurenhe
        2. image-2021-10-08-20-14-10-791.png
          167 kB
          Xurenhe

        Issue Links

          Activity

            People

              wojustme Xurenhe
              wojustme Xurenhe
              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 - 0.5h
                  0.5h