Neeraja created DRILL-1609:
------------------------------

             Summary: Sum/avg do not work on columns returned from subqueries
                 Key: DRILL-1609
                 URL: https://issues.apache.org/jira/browse/DRILL-1609
             Project: Apache Drill
          Issue Type: Bug
            Reporter: Neeraja


The following query fails when using sum/avg on columns returned from 
subqueries. count/max/min works fine.
This may be the root cause for  
https://issues.apache.org/jira/browse/DRILL-1607 as well , but keeping them as 
separate issues for now.

0: jdbc:drill:zk=local> select sum(c.f) from 
. . . . . . . . . . . > (select t.myarray.key1 as f from 
dfs.`/Users/nrentachintala/Downloads/drillreleases/apache-drill-0.7.0-incubating-SNAPSHOT/sample-data/mytest.json`
 t) c;
+------------+
|   EXPR$0   |
+------------+
Query failed: Failure while running fragment.

java.lang.RuntimeException: java.sql.SQLException: Failure while executing 
query.
        at sqlline.SqlLine$IncrementalRows.hasNext(SqlLine.java:2514)
        at sqlline.SqlLine$TableOutputFormat.print(SqlLine.java:2148)
        at sqlline.SqlLine.print(SqlLine.java:1809)
        at sqlline.SqlLine$Commands.execute(SqlLine.java:3766)
        at sqlline.SqlLine$Commands.sql(SqlLine.java:3663)
        at sqlline.SqlLine.dispatch(SqlLine.java:889)
        at sqlline.SqlLine.begin(SqlLine.java:763)
        at sqlline.SqlLine.start(SqlLine.java:498)
        at sqlline.SqlLine.main(SqlLine.java:460)
0: jdbc:drill:zk=local> explain plan for select sum(c.f) from 
. . . . . . . . . . . > (select t.myarray.key1 as f from 
dfs.`/Users/nrentachintala/Downloads/drillreleases/apache-drill-0.7.0-incubating-SNAPSHOT/sample-data/mytest.json`
 t) c;
+------------+------------+
|    text    |    json    |
+------------+------------+
| 00-00    Screen
00-01      StreamAgg(group=[{}], EXPR$0=[SUM($0)])
00-02        Project(f=[ITEM($0, 'key1')])
00-03          Scan(groupscan=[EasyGroupScan [selectionRoot=/Users/ |
+------------+------------+
1 row selected (0.176 seconds)

JSON file used is below.
{
        "name":"test",
        "myarray":{
                "key1":2,
                "key4":3,
                "key2":4
        }
}{
        "name":"mytest",
        "myarray":{
                "key3":2,
                "key5":3,
                "key6":4
        }
}



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

Reply via email to