Apache Drill
  1. Apache Drill
  2. DRILL-1266

Filter does not get pushed beyond sort when querying views created with order by

    Details

      Description

      Can reproduce the issue using the following steps.

      create view emp as select cast(e.employee_id as int)emp_id, cast(e.full_name as varchar(100))full_name from cp.`employee.json` e order by cast(employe_id as int);

      explain plan for select * from emp where emp_id > 100;

      Here is the plan for the query on the view with a simple filter.

      00-00 Screen
      00-01 Project(emp_id=[CAST($0):INTEGER NOT NULL], full_name=[CAST($1):VARCHAR(100) CHARACTER SET "ISO-8859-1" COLLATE "ISO-8859-1$en_US$primary" NOT NULL])
      00-02 SelectionVectorRemover
      00-03 Filter(condition=[>(CAST($0):INTEGER NOT NULL, 100)])
      00-04 Sort(sort0=[$2], dir0=[ASC])
      00-05 Project(emp_id=[CAST($1):INTEGER], full_name=[CAST($2):VARCHAR(100) CHARACTER SET "ISO-8859-1" COLLATE "ISO-8859-1$en_US$primary"], EXPR$2=[CAST($3):INTEGER])
      00-06 Scan(groupscan=[EasyGroupScan [selectionRoot=/employee.json, columns = null]])

        Activity

        Mehant Baid created issue -
        Jacques Nadeau made changes -
        Field Original Value New Value
        Fix Version/s 0.5.0 [ 12324880 ]
        Mehant Baid made changes -
        Fix Version/s 0.6.0 [ 12327472 ]
        Fix Version/s 0.5.0 [ 12324880 ]
        Jacques Nadeau made changes -
        Fix Version/s 0.7.0 [ 12327473 ]
        Fix Version/s 0.6.0 [ 12327472 ]
        Jacques Nadeau made changes -
        Fix Version/s 0.8.0 [ 12328812 ]
        Fix Version/s 0.7.0 [ 12327473 ]
        Jacques Nadeau made changes -
        Priority Major [ 3 ] Minor [ 4 ]
        Jacques Nadeau made changes -
        Fix Version/s 0.9.0 [ 12328813 ]
        Fix Version/s 0.8.0 [ 12328812 ]
        Jacques Nadeau made changes -
        Fix Version/s Future [ 12326743 ]
        Fix Version/s 0.9.0 [ 12328813 ]
        Component/s Query Planning & Optimization [ 12322681 ]
        Tony Stevenson made changes -
        Workflow no-reopen-closed, patch-avail, testing [ 12880831 ] Drill workflow [ 12935243 ]

          People

          • Assignee:
            Mehant Baid
            Reporter:
            Mehant Baid
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:

              Development