MCPcopy Create free account
hub / github.com/apache/pig / run

Method run

test/org/apache/pig/test/TestMRCompiler.java:1155–1191  ·  view source on GitHub ↗
(PhysicalPlan pp, String expectedFile)

Source from the content-addressed store, hash-verified

1153 }
1154
1155 private void run(PhysicalPlan pp, String expectedFile) throws Exception {
1156 String compiledPlan, goldenPlan = null;
1157 int MAX_SIZE = 100000;
1158 MRCompiler comp = new MRCompiler(pp, pc);
1159 comp.compile();
1160
1161 MROperPlan mrp = comp.getMRPlan();
1162 PlanPrinter ppp = new PlanPrinter(mrp);
1163 ByteArrayOutputStream baos = new ByteArrayOutputStream();
1164 ppp.print(baos);
1165 compiledPlan = baos.toString();
1166
1167 if(generate){
1168 FileOutputStream fos = new FileOutputStream(expectedFile);
1169 fos.write(baos.toByteArray());
1170 return;
1171 }
1172 FileInputStream fis = new FileInputStream(expectedFile);
1173 byte[] b = new byte[MAX_SIZE];
1174 int len = fis.read(b);
1175 goldenPlan = new String(b, 0, len);
1176 if (goldenPlan.charAt(len-1) == '\n')
1177 goldenPlan = goldenPlan.substring(0, len-1);
1178
1179 pp.explain(System.out);
1180 System.out.println();
1181 System.out.println("<<<" + compiledPlan + ">>>");
1182 System.out.println("-------------");
1183 System.out.println("Golden");
1184 System.out.println("<<<" + goldenPlan + ">>>");
1185 System.out.println("-------------");
1186
1187 String goldenPlanClean = Util.standardizeNewline(goldenPlan);
1188 String compiledPlanClean = Util.standardizeNewline(compiledPlan);
1189 assertEquals(TestHelper.sortUDFs(Util.removeSignature(goldenPlanClean)),
1190 TestHelper.sortUDFs(Util.removeSignature(compiledPlanClean)));
1191 }
1192
1193 public static class TestCollectableLoadFunc extends PigStorage implements CollectableLoadFunc {
1194 @Override

Callers 15

testRun1Method · 0.95
testRun2Method · 0.95
testSpl1Method · 0.95
testSpl2Method · 0.95
testSpl3Method · 0.95
testSim1Method · 0.95
testSim2Method · 0.95
testSim3Method · 0.95
testSim4Method · 0.95
testSim5Method · 0.95
testSim6Method · 0.95
testSim7Method · 0.95

Calls 11

compileMethod · 0.95
getMRPlanMethod · 0.95
printMethod · 0.95
standardizeNewlineMethod · 0.95
sortUDFsMethod · 0.95
removeSignatureMethod · 0.95
explainMethod · 0.65
toStringMethod · 0.45
writeMethod · 0.45
readMethod · 0.45
assertEqualsMethod · 0.45

Tested by

no test coverage detected