asdfgh19 created CALCITE-5594:
---------------------------------

             Summary: LatticeTest#testLatticeWithNoMeasures returns results not 
as expected
                 Key: CALCITE-5594
                 URL: https://issues.apache.org/jira/browse/CALCITE-5594
             Project: Calcite
          Issue Type: Test
          Components: core
    Affects Versions: 1.34.0
            Reporter: asdfgh19


  I changed the test testLatticeWithNoMeasures in LatticeTest to the following 
and ran, it returned 4.

  After that I changed enableMaterializations to false and re-run, the result 
returned 86837.

  Wondering why the results returned from the materialized view and from the 
original table are inconsistent.
{code:java}
@Test void testLatticeWithNoMeasures() {
  foodmartModel(" auto: false,\n"
      + "  tiles: [ {\n"
      + "    dimensions: [ 'the_year', ['t', 'quarter'] ],\n"
      + "    measures: [ ]\n"
      + "  } ]\n")
      .query("select count(*)\n"
          + "from \"foodmart\".\"sales_fact_1997\" as s\n"
          + "join \"foodmart\".\"time_by_day\" as t using (\"time_id\")\n")
      .enableMaterializations(true)
      .returns(rs -> {
        try {
          while (rs.next()) {
            System.out.println(rs.getObject(1));
          }
        } catch (Exception e) {
          fail(e);
        }
      });
} {code}
  The explain looks like this, should the original count be replaced by 
sum(count) in the materialized view, like 
MaterializedViewRelOptRulesTest#testAggregateMaterializationAggregateFuncs2.
{code:java}
EnumerableAggregate(group=[{}], EXPR$0=[COUNT()])
  EnumerableTableScan(table=[[adhoc, m{32, 36} {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to