XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.3.0
    • Table SQL / API
    • None

    Description

      The estimateRowCount method of DataSetCalc didn't work in the following situation.
      If I run the following code,

      Table table = tableEnv.sql("select a, avg(a), sum(b), count(c) from t1 where a==1 group by a");
      

      the cost of every node in Optimized node tree is :

      DataSetAggregate(groupBy=[a], select=[a, AVG(a) AS TMP_0, SUM(b) AS TMP_1, COUNT(c) AS TMP_2]): rowcount = 1000.0, cumulative cost = {3000.0 rows, 5000.0 cpu, 28000.0 io}
        DataSetCalc(select=[a, b, c], where=[=(a, 1)]): rowcount = 1000.0, cumulative cost = {2000.0 rows, 2000.0 cpu, 0.0 io}
            DataSetScan(table=[[_DataSetTable_0]]): rowcount = 1000.0, cumulative cost = {1000.0 rows, 1000.0 cpu, 0.0 io}
      

      We expect the input rowcount of DataSetAggregate less than 1000, however the actual input rowcount is still 1000 because the the estimateRowCount method of DataSetCalc didn't work.

      The problem is similar to the issue https://issues.apache.org/jira/browse/FLINK-5394 which is already solved.

      I find although we set metadata provider to FlinkDefaultRelMetadataProvider in FlinkRelBuilder, but after run

      planner.rel(...) 

      to translate SqlNode to RelNode, the metadata provider would be overrided from FlinkDefaultRelMetadataProvider to DefaultRelMetadataProvider again because of the following code:

            val cluster: RelOptCluster = RelOptCluster.create(planner, rexBuilder)
            val config = SqlToRelConverter.configBuilder()
              .withTrimUnusedFields(false).withConvertTableAccess(false).build()
            val sqlToRelConverter: SqlToRelConverter = new SqlToRelConverter(
              new ViewExpanderImpl, validator, createCatalogReader, cluster, convertletTable, config)
      

      Attachments

        Issue Links

          Activity

            People

              jingzhang Jing Zhang
              jingzhang Jing Zhang
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: