drill-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DRILL-4783) Flatten on CONVERT_FROM fails with ClassCastException if resultset is empty
Date Fri, 22 Jul 2016 04:22:20 GMT

    [ https://issues.apache.org/jira/browse/DRILL-4783?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15388889#comment-15388889
] 

ASF GitHub Bot commented on DRILL-4783:
---------------------------------------

Github user jinfengni commented on a diff in the pull request:

    https://github.com/apache/drill/pull/546#discussion_r71825128
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/flatten/FlattenRecordBatch.java
---
    @@ -267,6 +276,15 @@ private TransferPair getFlattenFieldTransferPair(FieldReference reference)
{
         if (flattenField instanceof RepeatedMapVector) {
           tp = ((RepeatedMapVector)flattenField).getTransferPairToSingleMap(reference.getAsNamePart().getName(),
oContext.getAllocator());
         } else {
    +      if ( !(flattenField instanceof RepeatedValueVector) ) {
    +        if(incoming.getRecordCount() != 0) {
    +          throw UserException.unsupportedError().message("Flatten does not support inputs
of non-list values.").build(logger);
    +        }
    +        logger.error("Cannot cast {} to RepeatedValueVector", flattenField);
    +        //when incoming recordCount is 0, don't throw exception since the type being
seen here is not solid
    +        ValueVector vv = new RepeatedMapVector(flattenField.getField(), oContext.getAllocator(),
null);
    +        tp = RepeatedValueVector.class.cast(vv).getTransferPair(reference.getAsNamePart().getName(),
oContext.getAllocator());
    +      }
           final ValueVector vvIn = RepeatedValueVector.class.cast(flattenField).getDataVector();
    --- End diff --
    
    Looks like an else is missing here. Otherwise, the first new unit test (with empty input
for flatten) will fail with ClassCastException.
     


> 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)

Mime
View raw message