Fix a bug in the project operator when the frame has 1 tuple or less
diff --git a/algebricks/algebricks-runtime/src/main/java/edu/uci/ics/hyracks/algebricks/runtime/operators/std/StreamProjectRuntimeFactory.java b/algebricks/algebricks-runtime/src/main/java/edu/uci/ics/hyracks/algebricks/runtime/operators/std/StreamProjectRuntimeFactory.java
index 7f10948..11f4486 100644
--- a/algebricks/algebricks-runtime/src/main/java/edu/uci/ics/hyracks/algebricks/runtime/operators/std/StreamProjectRuntimeFactory.java
+++ b/algebricks/algebricks-runtime/src/main/java/edu/uci/ics/hyracks/algebricks/runtime/operators/std/StreamProjectRuntimeFactory.java
@@ -69,17 +69,18 @@
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);
+ // Process last tuple but we must first check if there is still a tuple to process
+ if (t < nTuple) {
+ 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);
+ }
}
-
}
};
}
-
}