Changed WritableComparingComparatorFactory to use RawComparator. Changed FrameTupleAppender to accept IFrameTupleAccessor.
git-svn-id: https://hyracks.googlecode.com/svn/trunk@189 123451ca-8445-de46-9d55-352943316053
diff --git a/hyracks/hyracks-dataflow-common/src/main/java/edu/uci/ics/hyracks/dataflow/common/comm/io/FrameTupleAppender.java b/hyracks/hyracks-dataflow-common/src/main/java/edu/uci/ics/hyracks/dataflow/common/comm/io/FrameTupleAppender.java
index 460d049..bd5a907 100644
--- a/hyracks/hyracks-dataflow-common/src/main/java/edu/uci/ics/hyracks/dataflow/common/comm/io/FrameTupleAppender.java
+++ b/hyracks/hyracks-dataflow-common/src/main/java/edu/uci/ics/hyracks/dataflow/common/comm/io/FrameTupleAppender.java
@@ -16,6 +16,7 @@
import java.nio.ByteBuffer;
+import edu.uci.ics.hyracks.api.comm.IFrameTupleAccessor;
import edu.uci.ics.hyracks.api.context.IHyracksContext;
public class FrameTupleAppender {
@@ -59,7 +60,7 @@
return false;
}
- public boolean append(FrameTupleAccessor tupleAccessor, int tStartOffset, int tEndOffset) {
+ public boolean append(IFrameTupleAccessor tupleAccessor, int tStartOffset, int tEndOffset) {
int length = tEndOffset - tStartOffset;
if (tupleDataEndOffset + length + 4 + (tupleCount + 1) * 4 <= ctx.getFrameSize()) {
ByteBuffer src = tupleAccessor.getBuffer();
@@ -73,13 +74,13 @@
return false;
}
- public boolean append(FrameTupleAccessor tupleAccessor, int tIndex) {
+ public boolean append(IFrameTupleAccessor tupleAccessor, int tIndex) {
int tStartOffset = tupleAccessor.getTupleStartOffset(tIndex);
int tEndOffset = tupleAccessor.getTupleEndOffset(tIndex);
return append(tupleAccessor, tStartOffset, tEndOffset);
}
- public boolean appendConcat(FrameTupleAccessor accessor0, int tIndex0, FrameTupleAccessor accessor1, int tIndex1) {
+ public boolean appendConcat(IFrameTupleAccessor accessor0, int tIndex0, IFrameTupleAccessor accessor1, int tIndex1) {
int startOffset0 = accessor0.getTupleStartOffset(tIndex0);
int endOffset0 = accessor0.getTupleEndOffset(tIndex0);
int length0 = endOffset0 - startOffset0;
@@ -117,7 +118,7 @@
return false;
}
- public boolean appendProjection(FrameTupleAccessor accessor, int tIndex, int[] fields) {
+ public boolean appendProjection(IFrameTupleAccessor accessor, int tIndex, int[] fields) {
int fTargetSlotsLength = fields.length * 2;
int length = fTargetSlotsLength;
for (int i = 0; i < fields.length; ++i) {
diff --git a/hyracks/hyracks-dataflow-hadoop/src/main/java/edu/uci/ics/hyracks/dataflow/hadoop/data/WritableComparingComparatorFactory.java b/hyracks/hyracks-dataflow-hadoop/src/main/java/edu/uci/ics/hyracks/dataflow/hadoop/data/WritableComparingComparatorFactory.java
index c78648f..cec29d5 100644
--- a/hyracks/hyracks-dataflow-hadoop/src/main/java/edu/uci/ics/hyracks/dataflow/hadoop/data/WritableComparingComparatorFactory.java
+++ b/hyracks/hyracks-dataflow-hadoop/src/main/java/edu/uci/ics/hyracks/dataflow/hadoop/data/WritableComparingComparatorFactory.java
@@ -16,16 +16,15 @@
import org.apache.hadoop.io.RawComparator;
import org.apache.hadoop.io.WritableComparable;
-import org.apache.hadoop.io.WritableComparator;
import edu.uci.ics.hyracks.api.dataflow.value.IComparator;
import edu.uci.ics.hyracks.api.dataflow.value.IComparatorFactory;
import edu.uci.ics.hyracks.dataflow.common.util.ReflectionUtils;
public class WritableComparingComparatorFactory<T> implements IComparatorFactory<WritableComparable<T>> {
- private Class<? extends RawComparator> klass;
+ private Class<? extends RawComparator<? super WritableComparable<T>>> klass;
- public WritableComparingComparatorFactory(Class<? extends WritableComparator> klass) {
+ public WritableComparingComparatorFactory(Class<? extends RawComparator<? super WritableComparable<T>>> klass) {
this.klass = klass;
}
@@ -33,7 +32,7 @@
@Override
public IComparator<WritableComparable<T>> createComparator() {
- final RawComparator<WritableComparable<T>> instance = ReflectionUtils.createInstance(klass);
+ final RawComparator<? super WritableComparable<T>> instance = ReflectionUtils.createInstance(klass);
return new IComparator<WritableComparable<T>>() {
@Override
public int compare(WritableComparable<T> o1, WritableComparable<T> o2) {