You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Khurram Faraaz (JIRA)" <ji...@apache.org> on 2016/03/28 08:07:25 UTC

[jira] [Created] (DRILL-4545) Incorrect query plan for LIMIT 0 query

Khurram Faraaz created DRILL-4545:
-------------------------------------

             Summary: Incorrect query plan for LIMIT 0 query
                 Key: DRILL-4545
                 URL: https://issues.apache.org/jira/browse/DRILL-4545
             Project: Apache Drill
          Issue Type: Bug
          Components: Query Planning & Optimization
    Affects Versions: 1.6.0
         Environment: 4 node cluster CentOS
            Reporter: Khurram Faraaz


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

{noformat}
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]]])
{noformat}

Here is the data from JSON file

{noformat}
[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"]
}
{noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)