use of org.apache.hadoop.hive.ql.exec.vector.mapjoin.MapJoinTestConfig.TestMultiSetCollectorOperator in project hive by apache.
the class TestMapJoinOperator method executeTestImplementation.
private void executeTestImplementation(MapJoinTestImplementation mapJoinImplementation, MapJoinTestDescription testDesc, MapJoinTestData testData, RowTestObjectsMultiSet expectedTestRowMultiSet, String title) throws Exception {
System.out.println("*BENCHMARK* Starting implementation " + mapJoinImplementation + " variation " + testDesc.vectorMapJoinVariation + " title " + title);
// UNDONE: Parameterize for implementation variation?
MapJoinDesc mapJoinDesc = MapJoinTestConfig.createMapJoinDesc(testDesc);
final boolean isVectorOutput = MapJoinTestConfig.isVectorOutput(mapJoinImplementation);
RowTestObjectsMultiSet outputTestRowMultiSet = new RowTestObjectsMultiSet();
CreateMapJoinResult result = MapJoinTestConfig.createMapJoinImplementation(mapJoinImplementation, testDesc, testData, mapJoinDesc);
MapJoinOperator mapJoinOperator = result.mapJoinOperator;
MapJoinTableContainer mapJoinTableContainer = result.mapJoinTableContainer;
MapJoinTableContainerSerDe mapJoinTableContainerSerDe = result.mapJoinTableContainerSerDe;
CountCollectorTestOperator testCollectorOperator;
if (!isVectorOutput) {
testCollectorOperator = new TestMultiSetCollectorOperator(testDesc.outputObjectInspectors, outputTestRowMultiSet);
} else {
VectorizationContext vOutContext = ((VectorizationContextRegion) mapJoinOperator).getOutputVectorizationContext();
testCollectorOperator = new TestMultiSetVectorCollectorOperator(ArrayUtils.toPrimitive(vOutContext.getProjectedColumns().toArray(new Integer[0])), testDesc.outputTypeInfos, testDesc.outputObjectInspectors, outputTestRowMultiSet);
}
MapJoinTestConfig.connectOperators(mapJoinOperator, testCollectorOperator);
CountCollectorTestOperator interceptTestCollectorOperator = null;
if (testDesc.vectorMapJoinVariation == VectorMapJoinVariation.FULL_OUTER && !mapJoinDesc.isDynamicPartitionHashJoin()) {
if (mapJoinImplementation == MapJoinTestImplementation.ROW_MODE_HASH_MAP) {
// Not supported.
return;
}
// Wire in FULL OUTER Intercept.
interceptTestCollectorOperator = MapJoinTestConfig.addFullOuterIntercept(mapJoinImplementation, testDesc, outputTestRowMultiSet, testData, mapJoinOperator, mapJoinTableContainer, mapJoinTableContainerSerDe);
} else {
// Invoke initializeOp methods.
mapJoinOperator.initialize(testDesc.hiveConf, testDesc.inputObjectInspectors);
// Fixup the mapJoinTables.
mapJoinOperator.setTestMapJoinTableContainer(1, mapJoinTableContainer, mapJoinTableContainerSerDe);
}
if (!isVectorOutput) {
MapJoinTestData.driveBigTableData(testDesc, testData, mapJoinOperator);
} else {
MapJoinTestData.driveVectorBigTableData(testDesc, testData, mapJoinOperator);
}
if (!testCollectorOperator.getIsClosed()) {
Assert.fail("collector operator not closed");
}
if (testCollectorOperator.getIsAborted()) {
Assert.fail("collector operator aborted");
}
if (testDesc.vectorMapJoinVariation == VectorMapJoinVariation.FULL_OUTER && !mapJoinDesc.isDynamicPartitionHashJoin()) {
if (!interceptTestCollectorOperator.getIsClosed()) {
Assert.fail("intercept collector operator not closed");
}
if (interceptTestCollectorOperator.getIsAborted()) {
Assert.fail("intercept collector operator aborted");
}
}
System.out.println("*BENCHMARK* executeTestImplementation row count " + testCollectorOperator.getRowCount());
// Verify the output!
String option = "";
if (testDesc.vectorMapJoinVariation == VectorMapJoinVariation.FULL_OUTER) {
option = " mapJoinPlanVariation " + testDesc.mapJoinPlanVariation.name();
}
if (!expectedTestRowMultiSet.verify(outputTestRowMultiSet, "expected", "actual")) {
System.out.println("*BENCHMARK* " + title + " verify failed" + " for implementation " + mapJoinImplementation + " variation " + testDesc.vectorMapJoinVariation + option);
expectedTestRowMultiSet.displayDifferences(outputTestRowMultiSet, "expected", "actual");
} else {
System.out.println("*BENCHMARK* " + title + " verify succeeded " + " for implementation " + mapJoinImplementation + " variation " + testDesc.vectorMapJoinVariation + option);
}
}
Aggregations