You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by "Rahul Challapalli (JIRA)" <ji...@apache.org> on 2015/01/27 00:49:34 UTC

[jira] [Created] (DRILL-2075) Subquery not projecting the order by column is causing issues when used along with flatten

Rahul Challapalli created DRILL-2075:
----------------------------------------

             Summary: Subquery not projecting the order by column is causing issues when used along with flatten
                 Key: DRILL-2075
                 URL: https://issues.apache.org/jira/browse/DRILL-2075
             Project: Apache Drill
          Issue Type: Bug
          Components: Query Planning & Optimization
            Reporter: Rahul Challapalli
            Assignee: Jason Altekruse


git.commit.id.abbrev=3c6d0ef

Data Set :
{code}
{
  "uid" : 1,
  "uid_str" : "01",
  "type" : "web",
  "events" : [
        { "evnt_id":"e1", "campaign_id":"c1", "event_name":"e1_name", "event_time":1000000, "type" : "cmpgn1"},
        { "evnt_id":"e2", "campaign_id":"c1", "event_name":"e2_name", "event_time":2000000, "type" : "cmpgn4"},
        { "evnt_id":"e3", "campaign_id":"c1", "event_name":"e3_name", "event_time":3000000, "type" : "cmpgn1"},
        { "evnt_id":"e4", "campaign_id":"c1", "event_name":"e4_name", "event_time":4000000, "type" : "cmpgn1"},
        { "evnt_id":"e5", "campaign_id":"c2", "event_name":"e5_name", "event_time":5000000, "type" : "cmpgn3"},
        { "evnt_id":"e6", "campaign_id":"c1", "event_name":"e6_name", "event_time":6000000, "type" : "cmpgn9"},
        { "evnt_id":"e7", "campaign_id":"c1", "event_name":"e7_name", "event_time":7000000, "type" : "cmpgn3"},
        { "evnt_id":"e8", "campaign_id":"c2", "event_name":"e8_name", "event_time":8000000, "type" : "cmpgn2"},
        { "evnt_id":"e9", "campaign_id":"c2", "event_name":"e9_name", "event_time":9000000, "type" : "cmpgn4"}
  ]
}
{code}

Query with flatten :
{code}
select s.type  from (select d.type type, flatten(d.events) evnts from `temp.json` d where d.type='web' order by d.uid) s where s.type='web';
Query failed: IndexOutOfBoundsException: index (2) must be less than size (1)

Error: exception while executing query: Failure while executing query. (state=,code=0)
{code}

Query without flatten :
{code}
select s.type  from (select d.type type from `temp.json` d where d.type='web' order by d.uid) s where s.type='web';
+------------+
|    type    |
+------------+
| web        |
+------------+
{code}

However even the above query fails when we remove the filter and this could be related to DRILL-1302

{code}
0: jdbc:drill:schema=dfs.drillTestDir> select s.type  from (select d.type type from `temp.json` d where d.type='web' order by d.uid) s;
Query failed: ArrayIndexOutOfBoundsException: -1

Error: exception while executing query: Failure while executing query. (state=,code=0)
{code}



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