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/09/03 18:38:20 UTC

[jira] [Created] (DRILL-4875) select over array of maps returns incorrect results

Khurram Faraaz created DRILL-4875:
-------------------------------------

             Summary: select over array of maps returns incorrect results
                 Key: DRILL-4875
                 URL: https://issues.apache.org/jira/browse/DRILL-4875
             Project: Apache Drill
          Issue Type: Bug
          Components: Query Planning & Optimization
    Affects Versions: 1.9.0
         Environment: 4 node cluster CentOS
            Reporter: Khurram Faraaz
            Priority: Critical


select over array of maps returns incorrect results

Drill 1.9.0 git commit ID : 28d315bbb

Data used in test
{noformat}
[test@centos-a ~]# cat arrayofmaps.json
{"arr":[{"key":"a"},{"key":"b"},{"key":"c"},{"key":"d"}]}
{noformat}

Array elements are
{noformat}
0: jdbc:drill:schema=dfs.tmp> select t.arr from `arrayofmaps.json` t;
+----------------------------------------------------+
|                        arr                         |
+----------------------------------------------------+
| [{"key":"a"},{"key":"b"},{"key":"c"},{"key":"d"}]  |
+----------------------------------------------------+
1 row selected (0.289 seconds)
{noformat}

The below query should return 4 rows, each row containing one value a,b,c and d respectively
However query just returns only one value, which is not correct.
{noformat}
0: jdbc:drill:schema=dfs.tmp> select t.arr.key from `arrayofmaps.json` t where t.arr.key is not null;
+---------+
| EXPR$0  |
+---------+
| a       |
+---------+
1 row selected (0.33 seconds)
{noformat}

Explain plan for above failing query
{noformat}
0: jdbc:drill:schema=dfs.tmp> explain plan for select t.arr.key from `arrayofmaps.json` t where t.arr.key is not null;
+------+------+
| text | json |
+------+------+
| 00-00    Screen
00-01      Project(EXPR$0=[$0])
00-02        SelectionVectorRemover
00-03          Filter(condition=[IS NOT NULL($0)])
00-04            Project(ITEM=[ITEM($0, 'key')])
00-05              Scan(groupscan=[EasyGroupScan [selectionRoot=maprfs:/tmp/arrayofmaps.json, numFiles=1, columns=[`arr`.`key`], files=[maprfs:///tmp/arrayofmaps.json]]])
{noformat}



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