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.
     


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to