Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-7490

limit is not pushed to JDBC storage plugin

    XMLWordPrintableJSON

Details

    Description

      The limit is not pushed to JDBC storage plugin. 
      The following query:

      select person_id from mysql.`drill_mysql_test`.person limit 10
      

      Returns plan:

      00-00    Screen
      00-01      Project(person_id=[$0])
      00-02        SelectionVectorRemover
      00-03          Limit(fetch=[10])
      00-04            Limit(fetch=[10])
      00-05              Jdbc(sql=[SELECT `person_id` FROM `drill_mysql_test`.`person` ])
      

      This issue happens since incorrect row count is calculated for JdbcSort.
      Drill enforces to use RelNode.estimateRowCount(mq) for calculating row count for all inheritants of Sort rel node (see DrillRelMdRowCount), but JdbcSort doesn't override this method and uses parent one which returns row count of input. So planner choses DrillLimitRel since it has less row count.

      Attachments

        1. image-2020-07-24-17-31-02-589.png
          6 kB
          mustafa Erkoç
        2. image-2020-07-24-17-31-48-831.png
          6 kB
          mustafa Erkoç
        3. image-2020-07-24-17-35-28-912.png
          20 kB
          mustafa Erkoç
        4. image-2020-07-24-17-45-27-357.png
          8 kB
          mustafa Erkoç
        5. image-2020-07-24-17-46-05-219.png
          17 kB
          mustafa Erkoç
        6. image-2020-07-24-17-46-59-584.png
          10 kB
          mustafa Erkoç
        7. image-2020-07-24-17-48-53-740.png
          27 kB
          mustafa Erkoç

        Issue Links

          Activity

            People

              volodymyr Vova Vysotskyi
              volodymyr Vova Vysotskyi
              Arina Ielchiieva Arina Ielchiieva
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: