[ https://issues.apache.org/jira/browse/DRILL-4783?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15382645#comment-15382645 ]
ASF GitHub Bot commented on DRILL-4783: --------------------------------------- GitHub user chunhui-shi opened a pull request: https://github.com/apache/drill/pull/546 DRILL-4783: flatten operator should not throw exception if there is empty resultset returned for underlying operator which is convert_from or other complex functions. You can merge this pull request into a Git repository by running: $ git pull https://github.com/chunhui-shi/drill DRILL-4783-flatten Alternatively you can review and apply these changes as the patch at: https://github.com/apache/drill/pull/546.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #546 ---- commit 88dc26dfeb7f47ded0bfdc4c7f89e6bc55520344 Author: chunhui-shi <c...@maprtech.com> Date: 2016-07-16T07:18:33Z DRILL-4783: flatten operator handle empty resultset(and schema unknown due to this) ---- > Flatten on CONVERT_FROM fails with ClassCastException if resultset is empty > --------------------------------------------------------------------------- > > Key: DRILL-4783 > URL: https://issues.apache.org/jira/browse/DRILL-4783 > Project: Apache Drill > Issue Type: Bug > Reporter: Chunhui Shi > Assignee: Chunhui Shi > Priority: Critical > > Flatten failed to work on top of convert_from when the resultset is empty. > For a HBase table like this: > 0: jdbc:drill:zk=localhost:5181> select convert_from(t.address.cities,'json') > from hbase.`/tmp/flattentest` t; > +----------------------------------------------------------------------------------+ > | EXPR$0 > | > +----------------------------------------------------------------------------------+ > | {"list":[{"city":"SunnyVale"},{"city":"Palo Alto"},{"city":"Mountain > View"}]} | > | {"list":[{"city":"Seattle"},{"city":"Bellevue"},{"city":"Renton"}]} > | > | {"list":[{"city":"Minneapolis"},{"city":"Falcon Heights"},{"city":"San > Paul"}]} | > +----------------------------------------------------------------------------------+ > Flatten works when row_key is in (1,2,3) > 0: jdbc:drill:zk=localhost:5181> select flatten(t1.json.list) from (select > convert_from(t.address.cities,'json') json from hbase.`/tmp/flattentest` t > where row_key=1) t1; > +---------------------------+ > | EXPR$0 | > +---------------------------+ > | {"city":"SunnyVale"} | > | {"city":"Palo Alto"} | > | {"city":"Mountain View"} | > +---------------------------+ > But Flatten throws exception if the resultset is empty > 0: jdbc:drill:zk=localhost:5181> select flatten(t1.json.list) from (select > convert_from(t.address.cities,'json') json from hbase.`/tmp/flattentest` t > where row_key=4) t1; > Error: SYSTEM ERROR: ClassCastException: Cannot cast > org.apache.drill.exec.vector.NullableIntVector to > org.apache.drill.exec.vector.complex.RepeatedValueVector > Fragment 0:0 > [Error Id: 07fd0cab-d1e6-4259-bfec-ad80f02d93a2 on atsqa4-127.qa.lab:31010] > (state=,code=0) -- This message was sent by Atlassian JIRA (v6.3.4#6332)