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

Incorrect query plan for LIMIT 0 query

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Invalid
    • 1.6.0
    • None
    • 4 node cluster CentOS

    Description

      Inner query has a LIMIT 1 and outer query has LIMIT 0. Looking at the query plan it looks like the outer LIMIT 0 is applied before the LIMIT 1 is applied to inner query. This does not seem right.

      Drill 1.6.0 commit ID : fb09973e

      0: jdbc:drill:schema=dfs.tmp> explain plan for select * from (select * from `employee.json` limit 1) limit 0;
      +------+------+
      | text | json |
      +------+------+
      | 00-00    Screen
      00-01      Project(*=[$0])
      00-02        SelectionVectorRemover
      00-03          Limit(fetch=[0])
      00-04            Limit(fetch=[1])
      00-05              Limit(offset=[0], fetch=[0])
      00-06                Scan(groupscan=[EasyGroupScan [selectionRoot=maprfs:/tmp/employee.json, numFiles=1, columns=[`*`], files=[maprfs:///tmp/employee.json]]])
      

      Here is the data from JSON file

      [root@centos-01 ~]# cat employee.json
      {
        "firstName": "John",
        "lastName": "Smith",
        "isAlive": true,
        "age": 45,
        "height_cm": 177.6,
        "address": {
          "streetAddress": "29 4th Street",
          "city": "New York",
          "state": "NY",
          "postalCode": "10021-3100"
        },
        "phoneNumbers": [
          {
            "type": "home",
            "number": "212 555-1234"
          },
          {
            "type": "office",
            "number": "646 555-4567"
          }
        ],
        "children": [],
        "hobbies": ["scuba diving","hiking","biking","rock climbing","surfing"]
      }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            khfaraaz Khurram Faraaz
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: