abdullah alamoudi has submitted this change and it was merged.

Change subject: Allow Project Runtime to Pass Through an Empty Frame
......................................................................


Allow Project Runtime to Pass Through an Empty Frame

Before this change, project runtime expects at least a single record.
Now it can also process an empty frame.

Change-Id: I87dc6eb83a748f7f91610e7d11ebaec9be914e29
Reviewed-on: https://asterix-gerrit.ics.uci.edu/634
Tested-by: Jenkins <[email protected]>
Reviewed-by: abdullah alamoudi <[email protected]>
---
M 
algebricks/algebricks-runtime/src/main/java/org/apache/hyracks/algebricks/runtime/operators/std/StreamProjectRuntimeFactory.java
1 file changed, 15 insertions(+), 12 deletions(-)

Approvals:
  abdullah alamoudi: Looks good to me, approved
  Jenkins: Verified



diff --git 
a/algebricks/algebricks-runtime/src/main/java/org/apache/hyracks/algebricks/runtime/operators/std/StreamProjectRuntimeFactory.java
 
b/algebricks/algebricks-runtime/src/main/java/org/apache/hyracks/algebricks/runtime/operators/std/StreamProjectRuntimeFactory.java
index 001a598..43c63b5 100644
--- 
a/algebricks/algebricks-runtime/src/main/java/org/apache/hyracks/algebricks/runtime/operators/std/StreamProjectRuntimeFactory.java
+++ 
b/algebricks/algebricks-runtime/src/main/java/org/apache/hyracks/algebricks/runtime/operators/std/StreamProjectRuntimeFactory.java
@@ -65,23 +65,26 @@
 
             @Override
             public void nextFrame(ByteBuffer buffer) throws 
HyracksDataException {
+                // what if numOfTuples is 0?
                 tAccess.reset(buffer);
                 int nTuple = tAccess.getTupleCount();
-
-                int t = 0;
-                if (nTuple > 1) {
-                    for (; t < nTuple - 1; t++) {
+                if (nTuple == 0) {
+                    appender.flush(writer);
+                } else {
+                    int t = 0;
+                    if (nTuple > 1) {
+                        for (; t < nTuple - 1; t++) {
+                            appendProjectionToFrame(t, projectionList);
+                        }
+                    }
+                    if (flushFramesRapidly) {
+                        // Whenever all the tuples in the incoming frame have 
been consumed, the project operator
+                        // will push its frame to the next operator; i.e., it 
won't wait until the frame gets full.
+                        appendProjectionToFrame(t, projectionList, true);
+                    } else {
                         appendProjectionToFrame(t, projectionList);
                     }
                 }
-                if (flushFramesRapidly) {
-                    // Whenever all the tuples in the incoming frame have been 
consumed, the project operator
-                    // will push its frame to the next operator; i.e., it 
won't wait until the frame gets full.
-                    appendProjectionToFrame(t, projectionList, true);
-                } else {
-                    appendProjectionToFrame(t, projectionList);
-                }
-
             }
 
             @Override

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/634
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I87dc6eb83a748f7f91610e7d11ebaec9be914e29
Gerrit-PatchSet: 4
Gerrit-Project: hyracks
Gerrit-Branch: master
Gerrit-Owner: abdullah alamoudi <[email protected]>
Gerrit-Reviewer: Jenkins <[email protected]>
Gerrit-Reviewer: Till Westmann <[email protected]>
Gerrit-Reviewer: abdullah alamoudi <[email protected]>

Reply via email to