Make sure we flush a frame if there is only a single tuple.
diff --git a/algebricks/algebricks-runtime/src/main/java/edu/uci/ics/hyracks/algebricks/runtime/operators/std/AssignRuntimeFactory.java b/algebricks/algebricks-runtime/src/main/java/edu/uci/ics/hyracks/algebricks/runtime/operators/std/AssignRuntimeFactory.java
index 0b1ca0c..61582a4 100644
--- a/algebricks/algebricks-runtime/src/main/java/edu/uci/ics/hyracks/algebricks/runtime/operators/std/AssignRuntimeFactory.java
+++ b/algebricks/algebricks-runtime/src/main/java/edu/uci/ics/hyracks/algebricks/runtime/operators/std/AssignRuntimeFactory.java
@@ -115,10 +115,12 @@
tAccess.reset(buffer);
int nTuple = tAccess.getTupleCount();
int t = 0;
- for (; t < nTuple - 1; t++) {
- tRef.reset(tAccess, t);
- produceTuple(tupleBuilder, tAccess, t, tRef);
- appendToFrameFromTupleBuilder(tupleBuilder);
+ if (nTuple > 1) {
+ for (; t < nTuple - 1; t++) {
+ tRef.reset(tAccess, t);
+ produceTuple(tupleBuilder, tAccess, t, tRef);
+ appendToFrameFromTupleBuilder(tupleBuilder);
+ }
}
// Process last tuple, but first check if there is a tuple to process.
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 7a557ff..750455c 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
@@ -65,20 +65,23 @@
int nTuple = tAccess.getTupleCount();
int t = 0;
- for (; t < nTuple - 1; t++) {
- appendProjectionToFrame(t, projectionList);
+ 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);
+ // 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);
+ }
}
-
}
};
}
-
}