Fixed external sort flush/reset sequence. Fixed FrameSorter buffer length. Added normalized key to external sort in Word count example
git-svn-id: https://hyracks.googlecode.com/svn/trunk@149 123451ca-8445-de46-9d55-352943316053
diff --git a/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/sort/ExternalSortOperatorDescriptor.java b/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/sort/ExternalSortOperatorDescriptor.java
index 6075151..a408d85 100644
--- a/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/sort/ExternalSortOperatorDescriptor.java
+++ b/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/sort/ExternalSortOperatorDescriptor.java
@@ -120,7 +120,6 @@
public void nextFrame(ByteBuffer buffer) throws HyracksDataException {
if (frameSorter.getFrameCount() >= maxSortFrames) {
flushFramesToRun();
- frameSorter.reset();
}
frameSorter.insertFrame(buffer);
}
@@ -139,6 +138,7 @@
}
private void flushFramesToRun() throws HyracksDataException {
+ frameSorter.sortFrames();
File runFile;
try {
runFile = ctx.getResourceManager().createFile(
diff --git a/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/sort/FrameSorter.java b/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/sort/FrameSorter.java
index a4f4999..8a34e45 100644
--- a/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/sort/FrameSorter.java
+++ b/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/sort/FrameSorter.java
@@ -100,7 +100,7 @@
public void sortFrames() {
FrameTupleAccessor accessor = new FrameTupleAccessor(ctx, recordDescriptor);
- int nBuffers = buffers.size();
+ int nBuffers = dataFrameCount;
int totalTCount = 0;
for (int i = 0; i < nBuffers; ++i) {
accessor.reset(buffers.get(i));
diff --git a/hyracks/hyracks-examples/text-example/textclient/src/main/java/edu/uci/ics/hyracks/examples/text/client/WordCountMain.java b/hyracks/hyracks-examples/text-example/textclient/src/main/java/edu/uci/ics/hyracks/examples/text/client/WordCountMain.java
index b255258..f69b9fc 100644
--- a/hyracks/hyracks-examples/text-example/textclient/src/main/java/edu/uci/ics/hyracks/examples/text/client/WordCountMain.java
+++ b/hyracks/hyracks-examples/text-example/textclient/src/main/java/edu/uci/ics/hyracks/examples/text/client/WordCountMain.java
@@ -147,7 +147,8 @@
IBinaryComparatorFactory[] cfs = new IBinaryComparatorFactory[] { UTF8StringBinaryComparatorFactory.INSTANCE };
IOperatorDescriptor sorter = "memsort".equalsIgnoreCase(algo) ? new InMemorySortOperatorDescriptor(spec,
keys, new UTF8StringNormalizedKeyComputerFactory(), cfs, wordDesc)
- : new ExternalSortOperatorDescriptor(spec, sbSize, keys, cfs, wordDesc);
+ : new ExternalSortOperatorDescriptor(spec, sbSize, keys,
+ new UTF8StringNormalizedKeyComputerFactory(), cfs, wordDesc);
sorter.setPartitionConstraint(createPartitionConstraint(outSplits));
IConnectorDescriptor scanSortConn = new MToNHashPartitioningConnectorDescriptor(spec,