Fixed an incorrect initialization of the priority queue in external group operator. The bug may cause incorrect merging results. 

git-svn-id: https://hyracks.googlecode.com/svn/branches/hyracks_dev_next@1266 123451ca-8445-de46-9d55-352943316053
diff --git a/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/ExternalGroupOperatorDescriptor.java b/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/ExternalGroupOperatorDescriptor.java
index 1cab78d..58f9ffa 100644
--- a/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/ExternalGroupOperatorDescriptor.java
+++ b/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/ExternalGroupOperatorDescriptor.java
@@ -382,7 +382,8 @@
                          */
                         int[] tupleIndices = new int[runNumber];
 
-                        for (int runIndex = runNumber - 1; runIndex >= 0; runIndex--) {
+                        for (int i = 0; i < runNumber; i++) {
+                            int runIndex = topTuples.peek().getRunid();
                             tupleIndices[runIndex] = 0;
                             // Load the run file
                             runFileReaders[runIndex] = runs.get(runIndex);