本文整理汇总了Java中org.apache.flink.runtime.operators.CoGroupTaskExternalITCase.MockCoGroupStub类的典型用法代码示例。如果您正苦于以下问题:Java MockCoGroupStub类的具体用法?Java MockCoGroupStub怎么用?Java MockCoGroupStub使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MockCoGroupStub类属于org.apache.flink.runtime.operators.CoGroupTaskExternalITCase包,在下文中一共展示了MockCoGroupStub类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSortBoth1CoGroupTask
import org.apache.flink.runtime.operators.CoGroupTaskExternalITCase.MockCoGroupStub; //导入依赖的package包/类
@Test
public void testSortBoth1CoGroupTask() {
int keyCnt1 = 100;
int valCnt1 = 2;
int keyCnt2 = 200;
int valCnt2 = 1;
final int expCnt = valCnt1*valCnt2*Math.min(keyCnt1, keyCnt2) +
(keyCnt1 > keyCnt2 ? (keyCnt1 - keyCnt2) * valCnt1 : (keyCnt2 - keyCnt1) * valCnt2);
setOutput(this.output);
addDriverComparator(this.comparator1);
addDriverComparator(this.comparator2);
getTaskConfig().setDriverPairComparator(RecordPairComparatorFactory.get());
getTaskConfig().setDriverStrategy(DriverStrategy.CO_GROUP);
final CoGroupDriver<Record, Record, Record> testTask = new CoGroupDriver<Record, Record, Record>();
try {
addInputSorted(new UniformRecordGenerator(keyCnt1, valCnt1, false), this.comparator1.duplicate());
addInputSorted(new UniformRecordGenerator(keyCnt2, valCnt2, false), this.comparator2.duplicate());
testDriver(testTask, MockCoGroupStub.class);
} catch (Exception e) {
e.printStackTrace();
Assert.fail("The test caused an exception.");
}
Assert.assertEquals("Wrong result set size.", expCnt, this.output.getNumberOfRecords());
}
示例2: testSortBoth2CoGroupTask
import org.apache.flink.runtime.operators.CoGroupTaskExternalITCase.MockCoGroupStub; //导入依赖的package包/类
@Test
public void testSortBoth2CoGroupTask() {
int keyCnt1 = 200;
int valCnt1 = 2;
int keyCnt2 = 200;
int valCnt2 = 4;
final int expCnt = valCnt1*valCnt2*Math.min(keyCnt1, keyCnt2) +
(keyCnt1 > keyCnt2 ? (keyCnt1 - keyCnt2) * valCnt1 : (keyCnt2 - keyCnt1) * valCnt2);
setOutput(this.output);
addDriverComparator(this.comparator1);
addDriverComparator(this.comparator2);
getTaskConfig().setDriverPairComparator(RecordPairComparatorFactory.get());
getTaskConfig().setDriverStrategy(DriverStrategy.CO_GROUP);
final CoGroupDriver<Record, Record, Record> testTask = new CoGroupDriver<Record, Record, Record>();
try {
addInputSorted(new UniformRecordGenerator(keyCnt1, valCnt1, false), this.comparator1.duplicate());
addInputSorted(new UniformRecordGenerator(keyCnt2, valCnt2, false), this.comparator2.duplicate());
testDriver(testTask, MockCoGroupStub.class);
} catch (Exception e) {
e.printStackTrace();
Assert.fail("The test caused an exception.");
}
Assert.assertEquals("Wrong result set size.", expCnt, this.output.getNumberOfRecords());
}
示例3: testSortFirstCoGroupTask
import org.apache.flink.runtime.operators.CoGroupTaskExternalITCase.MockCoGroupStub; //导入依赖的package包/类
@Test
public void testSortFirstCoGroupTask() {
int keyCnt1 = 200;
int valCnt1 = 2;
int keyCnt2 = 200;
int valCnt2 = 4;
final int expCnt = valCnt1*valCnt2*Math.min(keyCnt1, keyCnt2) +
(keyCnt1 > keyCnt2 ? (keyCnt1 - keyCnt2) * valCnt1 : (keyCnt2 - keyCnt1) * valCnt2);
setOutput(this.output);
addDriverComparator(this.comparator1);
addDriverComparator(this.comparator2);
getTaskConfig().setDriverPairComparator(RecordPairComparatorFactory.get());
getTaskConfig().setDriverStrategy(DriverStrategy.CO_GROUP);
final CoGroupDriver<Record, Record, Record> testTask = new CoGroupDriver<Record, Record, Record>();
try {
addInputSorted(new UniformRecordGenerator(keyCnt1, valCnt1, false), this.comparator1.duplicate());
addInput(new UniformRecordGenerator(keyCnt2, valCnt2, true));
testDriver(testTask, MockCoGroupStub.class);
} catch (Exception e) {
e.printStackTrace();
Assert.fail("The test caused an exception.");
}
Assert.assertEquals("Wrong result set size.", expCnt, this.output.getNumberOfRecords());
}
示例4: testSortSecondCoGroupTask
import org.apache.flink.runtime.operators.CoGroupTaskExternalITCase.MockCoGroupStub; //导入依赖的package包/类
@Test
public void testSortSecondCoGroupTask() {
int keyCnt1 = 200;
int valCnt1 = 2;
int keyCnt2 = 200;
int valCnt2 = 4;
final int expCnt = valCnt1*valCnt2*Math.min(keyCnt1, keyCnt2) +
(keyCnt1 > keyCnt2 ? (keyCnt1 - keyCnt2) * valCnt1 : (keyCnt2 - keyCnt1) * valCnt2);
setOutput(this.output);
addDriverComparator(this.comparator1);
addDriverComparator(this.comparator2);
getTaskConfig().setDriverPairComparator(RecordPairComparatorFactory.get());
getTaskConfig().setDriverStrategy(DriverStrategy.CO_GROUP);
final CoGroupDriver<Record, Record, Record> testTask = new CoGroupDriver<Record, Record, Record>();
try {
addInput(new UniformRecordGenerator(keyCnt1, valCnt1, true));
addInputSorted(new UniformRecordGenerator(keyCnt2, valCnt2, false), this.comparator2.duplicate());
testDriver(testTask, MockCoGroupStub.class);
} catch (Exception e) {
e.printStackTrace();
Assert.fail("The test caused an exception.");
}
Assert.assertEquals("Wrong result set size.", expCnt, this.output.getNumberOfRecords());
}
示例5: testMergeCoGroupTask
import org.apache.flink.runtime.operators.CoGroupTaskExternalITCase.MockCoGroupStub; //导入依赖的package包/类
@Test
public void testMergeCoGroupTask() {
int keyCnt1 = 200;
int valCnt1 = 2;
int keyCnt2 = 200;
int valCnt2 = 4;
final int expCnt = valCnt1*valCnt2*Math.min(keyCnt1, keyCnt2) +
(keyCnt1 > keyCnt2 ? (keyCnt1 - keyCnt2) * valCnt1 : (keyCnt2 - keyCnt1) * valCnt2);
setOutput(this.output);
addInput(new UniformRecordGenerator(keyCnt1, valCnt1, true));
addInput(new UniformRecordGenerator(keyCnt2, valCnt2, true));
addDriverComparator(this.comparator1);
addDriverComparator(this.comparator2);
getTaskConfig().setDriverPairComparator(RecordPairComparatorFactory.get());
getTaskConfig().setDriverStrategy(DriverStrategy.CO_GROUP);
final CoGroupDriver<Record, Record, Record> testTask = new CoGroupDriver<Record, Record, Record>();
try {
testDriver(testTask, MockCoGroupStub.class);
} catch (Exception e) {
e.printStackTrace();
Assert.fail("The test caused an exception.");
}
Assert.assertEquals("Wrong result set size.", expCnt, this.output.getNumberOfRecords());
}