}
}
@Test
public void testNulls() throws Exception {
ExecutionEngine ee =
new ExecutionEngineJNI(
1,
1,
0,
0,
"",
100,
new HashinatorConfig(hashinatorType, TheHashinator.getConfigureBytes(2), 0, 0));
final byte configBytes[] = TheHashinator.getConfigureBytes(2);
TheHashinator.initialize(TheHashinator.getConfiguredHashinatorClass(), configBytes);
int jHash =
TheHashinator.getPartitionForParameter(VoltType.TINYINT.getValue(), new Byte(VoltType.NULL_TINYINT));
int cHash = ee.hashinate(VoltType.NULL_TINYINT, TheHashinator.getCurrentConfig());
assertEquals(0, jHash);
assertEquals(jHash, cHash);
System.out.println("jhash " + jHash + " chash " + cHash);
jHash = TheHashinator.getPartitionForParameter(VoltType.SMALLINT.getValue(),
new Short(VoltType.NULL_SMALLINT));
cHash = ee.hashinate(VoltType.NULL_SMALLINT, TheHashinator.getCurrentConfig());
assertEquals(0, jHash);
assertEquals(jHash, cHash);
System.out.println("jhash " + jHash + " chash " + cHash);
jHash = TheHashinator.getPartitionForParameter(VoltType.INTEGER.getValue(),
new Integer(VoltType.NULL_INTEGER));
cHash = ee.hashinate(
VoltType.NULL_INTEGER,
TheHashinator.getCurrentConfig());
assertEquals(0, jHash);
assertEquals(jHash, cHash);
System.out.println("jhash " + jHash + " chash " + cHash);
jHash = TheHashinator.getPartitionForParameter(VoltType.BIGINT.getValue(), new Long(VoltType.NULL_BIGINT));
cHash = ee.hashinate(
VoltType.NULL_BIGINT,
TheHashinator.getCurrentConfig());
assertEquals(0, jHash);
assertEquals(jHash, cHash);
System.out.println("jhash " + jHash + " chash " + cHash);
jHash = TheHashinator.getPartitionForParameter(VoltType.STRING.getValue(),
VoltType.NULL_STRING_OR_VARBINARY);
cHash = ee.hashinate(
VoltType.NULL_STRING_OR_VARBINARY,
TheHashinator.getCurrentConfig());
assertEquals(0, jHash);
assertEquals(jHash, cHash);
System.out.println("jhash " + jHash + " chash " + cHash);
jHash = TheHashinator.getPartitionForParameter(VoltType.VARBINARY.getValue(), null);
cHash = ee.hashinate(
null,
TheHashinator.getCurrentConfig());
assertEquals(0, jHash);
assertEquals(jHash, cHash);
System.out.println("jhash " + jHash + " chash " + cHash);
try { ee.release(); } catch (Exception e) {}
}