You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by GitBox <gi...@apache.org> on 2018/07/18 14:42:42 UTC

[GitHub] vrozov commented on a change in pull request #1383: DRILL-6613: Refactor MaterializedField

vrozov commented on a change in pull request #1383: DRILL-6613: Refactor MaterializedField
URL: https://github.com/apache/drill/pull/1383#discussion_r203406367
 
 

 ##########
 File path: exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/flatten/FlattenRecordBatch.java
 ##########
 @@ -453,22 +453,15 @@ protected boolean setupNewSchema() throws SchemaChangeException {
         cg.addExpr(expr);
       } else {
         // need to do evaluation.
-        final MaterializedField outputField;
+        ValueVector incomingVector = null;
         if (expr instanceof ValueVectorReadExpression) {
           final TypedFieldId id = ValueVectorReadExpression.class.cast(expr).getFieldId();
-          @SuppressWarnings("resource")
-          final ValueVector incomingVector = incoming.getValueAccessorById(id.getIntermediateClass(), id.getFieldIds()).getValueVector();
-          // outputField is taken from the incoming schema to avoid the loss of nested fields
-          // when the first batch will be empty.
-          if (incomingVector != null) {
-            outputField = incomingVector.getField().clone();
-          } else {
-            outputField = MaterializedField.create(outputName, expr.getMajorType());
-          }
-        } else {
-          outputField = MaterializedField.create(outputName, expr.getMajorType());
+          incomingVector = incoming.getValueAccessorById(id.getIntermediateClass(), id.getFieldIds()).getValueVector();
 
 Review comment:
   There is no dropped code, the code is re-organized to avoid nested if/else.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services