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

 ##########
 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:
   Are we sure that the dropped code is not needed? This looks like one of 
those fixes added after a session with the school of hard knocks. That is, 
added to fix some specific bug.
   
   Can we track down the JIRA ticket to see what the problem is that the code 
solved and run a test to ensure that removing the code doesn't cause a 
regression?

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to