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

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

KazydubB commented on pull request #1861: DRILL-7380: Query of a field inside 
of an array of structs returns null
URL: https://github.com/apache/drill/pull/1861#discussion_r328614853
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet2/DrillParquetReader.java
 ##########
 @@ -233,28 +288,26 @@ public void setup(OperatorContext context, OutputMutator 
output) throws Executio
       this.operatorContext = context;
       schema = footer.getFileMetaData().getSchema();
       MessageType projection;
+      final List<SchemaPath> columnsNotFound = new 
ArrayList<>(getColumns().size());
 
       if (isStarQuery()) {
         projection = schema;
       } else {
-        columnsNotFound = new ArrayList<>();
         projection = getProjection(schema, getColumns(), columnsNotFound);
         if (projection == null) {
           projection = schema;
         }
-        if (columnsNotFound != null && columnsNotFound.size() > 0) {
-          nullFilledVectors = new ArrayList<>();
-          for (SchemaPath col: columnsNotFound) {
+        if (columnsNotFound.size() > 0) {
+          nullFilledVectors = new ArrayList<>(columnsNotFound.size());
+          for (SchemaPath col : columnsNotFound) {
             // col.toExpr() is used here as field name since we don't want to 
see these fields in the existing maps
             nullFilledVectors.add(
-              (NullableIntVector) 
output.addField(MaterializedField.create(col.toExpr(),
-                  
org.apache.drill.common.types.Types.optional(TypeProtos.MinorType.INT)),
-                (Class<? extends ValueVector>) 
TypeHelper.getValueVectorClass(TypeProtos.MinorType.INT,
-                  TypeProtos.DataMode.OPTIONAL)));
-          }
-          if (columnsNotFound.size() == getColumns().size()) {
-            noColumnsFound = true;
+                (NullableIntVector) 
output.addField(MaterializedField.create(col.toExpr(),
+                    
org.apache.drill.common.types.Types.optional(TypeProtos.MinorType.INT)),
+                    (Class<? extends ValueVector>) 
TypeHelper.getValueVectorClass(TypeProtos.MinorType.INT,
 
 Review comment:
   This `TypeHelper.getValueVectorClass(...)` may be changed to 
`NullableIntVector.class`.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Query of a field inside of an array of structs returns null
> -----------------------------------------------------------
>
>                 Key: DRILL-7380
>                 URL: https://issues.apache.org/jira/browse/DRILL-7380
>             Project: Apache Drill
>          Issue Type: Bug
>    Affects Versions: 1.17.0
>            Reporter: Anton Gozhiy
>            Assignee: Igor Guzenko
>            Priority: Major
>         Attachments: customer_complex.zip
>
>
> *Query:*
> {code:sql}
> select t.c_orders[0].o_orderstatus from hive.customer_complex t limit 10;
> {code}
> *Expected results (given from Hive):*
> {noformat}
> OK
> O
> F
> NULL
> O
> O
> NULL
> O
> O
> NULL
> F
> {noformat}
> *Actual results:*
> {noformat}
> null
> null
> null
> null
> null
> null
> null
> null
> null
> null
> {noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to