Fix a bug in the assign 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/AssignRuntimeFactory.java b/algebricks/algebricks-runtime/src/main/java/edu/uci/ics/hyracks/algebricks/runtime/operators/std/AssignRuntimeFactory.java
index 620b9eb..0b1ca0c 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
@@ -120,14 +120,18 @@
produceTuple(tupleBuilder, tAccess, t, tRef);
appendToFrameFromTupleBuilder(tupleBuilder);
}
- tRef.reset(tAccess, t);
- produceTuple(tupleBuilder, tAccess, t, tRef);
- if (flushFramesRapidly) {
- // Whenever all the tuples in the incoming frame have been consumed, the assign operator
- // will push its frame to the next operator; i.e., it won't wait until the frame gets full.
- appendToFrameFromTupleBuilder(tupleBuilder, true);
- } else {
- appendToFrameFromTupleBuilder(tupleBuilder);
+
+ // Process last tuple, but first check if there is a tuple to process.
+ if (t < nTuple) {
+ tRef.reset(tAccess, t);
+ produceTuple(tupleBuilder, tAccess, t, tRef);
+ if (flushFramesRapidly) {
+ // Whenever all the tuples in the incoming frame have been consumed, the assign operator
+ // will push its frame to the next operator; i.e., it won't wait until the frame gets full.
+ appendToFrameFromTupleBuilder(tupleBuilder, true);
+ } else {
+ appendToFrameFromTupleBuilder(tupleBuilder);
+ }
}
}