ihuzenko commented on a change in pull request #1975: DRILL-7576: Fail fast for 
operator errors
URL: https://github.com/apache/drill/pull/1975#discussion_r376942403
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/WriterRecordBatch.java
 ##########
 @@ -77,54 +80,53 @@ public BatchSchema getSchema() {
   @Override
   public IterOutcome innerNext() {
     if (processed) {
-//      cleanup();
       // if the upstream record batch is already processed and next() is 
called by
       // downstream then return NONE to indicate completion
       return IterOutcome.NONE;
     }
 
     // process the complete upstream in one next() call
     IterOutcome upstream;
-    try {
-      do {
-        upstream = next(incoming);
-
-        switch(upstream) {
-          case STOP:
-            return upstream;
-
-          case NOT_YET:
+    do {
+      upstream = next(incoming);
+
+      switch(upstream) {
+        case STOP:
+          return upstream;
+
+        case NOT_YET:
+          break;
+        case NONE:
+          if (schema != null) {
+            // Schema is for the output batch schema which is setup in 
setupNewSchema(). Since the output
+            // schema is fixed ((Fragment(VARCHAR), Number of records written 
(BIGINT)) we should set it
+            // up even with 0 records for it to be reported back to the client.
             break;
-          case NONE:
-            if (schema != null) {
-              // Schema is for the output batch schema which is setup in 
setupNewSchema(). Since the output
-              // schema is fixed ((Fragment(VARCHAR), Number of records 
written (BIGINT)) we should set it
-              // up even with 0 records for it to be reported back to the 
client.
-              break;
-            }
-
-          case OK_NEW_SCHEMA:
-            setupNewSchema();
-            // $FALL-THROUGH$
-          case OK:
-            counter += eventBasedRecordWriter.write(incoming.getRecordCount());
-            logger.debug("Total records written so far: {}", counter);
+          }
 
-            for(final VectorWrapper<?> v : incoming) {
-              v.getValueVector().clear();
-            }
-            break;
-
-          default:
-            throw new UnsupportedOperationException();
-        }
-      } while(upstream != IterOutcome.NONE);
-    } catch(IOException ex) {
-      logger.error("Failure during query", ex);
-      kill(false);
-      context.getExecutorState().fail(ex);
-      return IterOutcome.STOP;
-    }
+        case OK_NEW_SCHEMA:
+          setupNewSchema();
+          // $FALL-THROUGH$
+        case OK:
+          try {
+            counter += eventBasedRecordWriter.write(incoming.getRecordCount());
+          } catch (IOException e) {
+            // TODO: Better handled inside the write() method.
 
 Review comment:
   can we avoid leaving new todos in the code?

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


With regards,
Apache Git Services

Reply via email to