asterixdb-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "abdullah alamoudi (Code Review)" <do-not-re...@asterixdb.incubator.apache.org>
Subject Change in hyracks[master]: Allow Project Runtime to Pass Through an Empty Frame
Date Mon, 15 Feb 2016 13:26:03 GMT
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 <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: abdullah alamoudi <bamousaa@gmail.com>
---
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 <bamousaa@gmail.com>
Gerrit-Reviewer: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Till Westmann <tillw@apache.org>
Gerrit-Reviewer: abdullah alamoudi <bamousaa@gmail.com>

Mime
View raw message