use of org.apache.flink.streaming.api.functions.windowing.delta.extractor.FieldsFromTuple in project flink by apache.
the class FieldsFromTupleTest method testUserSpecifiedOrder.
@Test
public void testUserSpecifiedOrder() throws InstantiationException, IllegalAccessException {
Tuple currentTuple = (Tuple) CLASSES[Tuple.MAX_ARITY - 1].newInstance();
for (int i = 0; i < Tuple.MAX_ARITY; i++) {
currentTuple.setField(testDouble[i], i);
}
double[] expected = { testDouble[5], testDouble[3], testDouble[6], testDouble[7], testDouble[0] };
arrayEqualityCheck(expected, new FieldsFromTuple(5, 3, 6, 7, 0).extract(currentTuple));
double[] expected2 = { testDouble[0], testDouble[Tuple.MAX_ARITY - 1] };
arrayEqualityCheck(expected2, new FieldsFromTuple(0, Tuple.MAX_ARITY - 1).extract(currentTuple));
double[] expected3 = { testDouble[Tuple.MAX_ARITY - 1], testDouble[0] };
arrayEqualityCheck(expected3, new FieldsFromTuple(Tuple.MAX_ARITY - 1, 0).extract(currentTuple));
double[] expected4 = { testDouble[13], testDouble[4], testDouble[5], testDouble[4], testDouble[2], testDouble[8], testDouble[6], testDouble[2], testDouble[8], testDouble[3], testDouble[5], testDouble[2], testDouble[16], testDouble[4], testDouble[3], testDouble[2], testDouble[6], testDouble[4], testDouble[7], testDouble[4], testDouble[2], testDouble[8], testDouble[7], testDouble[2] };
arrayEqualityCheck(expected4, new FieldsFromTuple(13, 4, 5, 4, 2, 8, 6, 2, 8, 3, 5, 2, 16, 4, 3, 2, 6, 4, 7, 4, 2, 8, 7, 2).extract(currentTuple));
}
Aggregations