use of org.apache.flink.table.runtime.generated.HashFunction in project flink by apache.
the class CodeSplitTest method testHashFunction.
@Test
public void testHashFunction() {
int numFields = 1000;
RowType rowType = getIntRowType(numFields);
int[] hashFields = new int[numFields];
for (int i = 0; i < numFields; i++) {
hashFields[i] = i;
}
GenericRowData rowData = new GenericRowData(numFields);
for (int i = 0; i < numFields; i++) {
rowData.setField(i, i);
}
Consumer<TableConfig> consumer = tableConfig -> {
HashFunction instance = HashCodeGenerator.generateRowHash(new CodeGeneratorContext(tableConfig), rowType, "", hashFields).newInstance(classLoader);
for (int i = 0; i < 100; i++) {
Assert.assertEquals(-1433414860, instance.hashCode(rowData));
}
};
runTest(consumer);
}
Aggregations