Vova Vysotskyi created DRILL-7490:
-------------------------------------

             Summary: limit is not pushed to JDBC storage plugin
                 Key: DRILL-7490
                 URL: https://issues.apache.org/jira/browse/DRILL-7490
             Project: Apache Drill
          Issue Type: Bug
          Components: Client - JDBC
    Affects Versions: 1.11.0
            Reporter: Vova Vysotskyi
            Assignee: Vova Vysotskyi


The limit is not pushed to JDBC storage plugin. 
The following query:
{code:sql}
select person_id from mysql.`drill_mysql_test`.person limit 10
{code}
Returns plan:
{noformat}
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` ])
{noformat}

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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to