checkpoint: enable generic binary hashing for all types
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/hash/AObjectBinaryHashFunctionFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/hash/AObjectBinaryHashFunctionFactory.java
index 570d8ae..e132814 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/hash/AObjectBinaryHashFunctionFactory.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/hash/AObjectBinaryHashFunctionFactory.java
@@ -37,6 +37,9 @@
private IBinaryHashFunction rectangleHash = RectangleBinaryHashFunctionFactory.INSTANCE
.createBinaryHashFunction();
+ private IBinaryHashFunction genericBinaryHash = MurmurHash3BinaryHashFunctionFamily.INSTANCE
+ .createBinaryHashFunction(0);
+
@Override
public int hash(byte[] bytes, int offset, int length) {
ATypeTag tag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[offset]);
@@ -71,7 +74,7 @@
return 0;
}
default: {
- throw new NotImplementedException("Binary hashing for the " + tag + " type is not implemented.");
+ return genericBinaryHash.hash(bytes, offset + 1, length - 1);
}
}
}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlBinaryHashFunctionFactoryProvider.java b/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlBinaryHashFunctionFactoryProvider.java
index cbc4745..47ba267 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlBinaryHashFunctionFactoryProvider.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlBinaryHashFunctionFactoryProvider.java
@@ -6,9 +6,9 @@
import edu.uci.ics.asterix.dataflow.data.nontagged.hash.BooleanBinaryHashFunctionFactory;
import edu.uci.ics.asterix.dataflow.data.nontagged.hash.DoubleBinaryHashFunctionFactory;
import edu.uci.ics.asterix.dataflow.data.nontagged.hash.LongBinaryHashFunctionFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.hash.MurmurHash3BinaryHashFunctionFamily;
import edu.uci.ics.asterix.dataflow.data.nontagged.hash.RectangleBinaryHashFunctionFactory;
import edu.uci.ics.asterix.om.types.IAType;
-import edu.uci.ics.hyracks.algebricks.common.exceptions.NotImplementedException;
import edu.uci.ics.hyracks.algebricks.data.IBinaryHashFunctionFactoryProvider;
import edu.uci.ics.hyracks.api.dataflow.value.IBinaryHashFunction;
import edu.uci.ics.hyracks.api.dataflow.value.IBinaryHashFunctionFactory;
@@ -93,8 +93,7 @@
return addOffset(RectangleBinaryHashFunctionFactory.INSTANCE);
}
default: {
- throw new NotImplementedException("No binary hash function factory implemented for type "
- + aqlType.getTypeTag() + " .");
+ return addOffsetForGenericBinaryHash();
}
}
}
@@ -118,4 +117,16 @@
};
}
+ private IBinaryHashFunctionFactory addOffsetForGenericBinaryHash() {
+ return new IBinaryHashFunctionFactory() {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public IBinaryHashFunction createBinaryHashFunction() {
+ return MurmurHash3BinaryHashFunctionFamily.INSTANCE.createBinaryHashFunction(0);
+ }
+ };
+ }
+
}