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

Method run

test/org/apache/pig/tez/TestTezCompiler.java:1373–1411  ·  view source on GitHub ↗
(String query, String expectedFile)

Source from the content-addressed store, hash-verified

1371 }
1372
1373 private void run(String query, String expectedFile) throws Exception {
1374 PhysicalPlan pp = Util.buildPp(pigServer, query);
1375 TezLauncher launcher = new TezLauncher();
1376 pc.inExplain = true;
1377 TezPlanContainer tezPlanContainer = launcher.compile(pp, pc);
1378
1379 ByteArrayOutputStream baos = new ByteArrayOutputStream();
1380 PrintStream ps = new PrintStream(baos);
1381 TezPlanContainerPrinter printer = new TezPlanContainerPrinter(ps, tezPlanContainer);
1382 printer.visit();
1383 String compiledPlan = baos.toString();
1384 System.out.println();
1385 System.out.println("<<<" + compiledPlan + ">>>");
1386
1387 if (generate) {
1388 FileOutputStream fos = new FileOutputStream(expectedFile);
1389 fos.write(baos.toByteArray());
1390 fos.close();
1391 return;
1392 }
1393 FileInputStream fis = new FileInputStream(expectedFile);
1394 byte[] b = new byte[MAX_SIZE];
1395 int len = fis.read(b);
1396 fis.close();
1397 String goldenPlan = new String(b, 0, len);
1398 if (goldenPlan.charAt(len-1) == '\n') {
1399 goldenPlan = goldenPlan.substring(0, len-1);
1400 }
1401
1402 System.out.println("-------------");
1403 System.out.println("Golden");
1404 System.out.println("<<<" + goldenPlan + ">>>");
1405 System.out.println("-------------");
1406
1407 String goldenPlanClean = Util.standardizeNewline(goldenPlan).trim();
1408 String compiledPlanClean = Util.standardizeNewline(compiledPlan).trim();
1409 assertEquals(TestHelper.sortUDFs(Util.removeSignature(goldenPlanClean)),
1410 TestHelper.sortUDFs(Util.removeSignature(compiledPlanClean)));
1411 }
1412
1413 public static class TestDummyStoreFunc extends StoreFunc {
1414

Callers 15

testStoreLoadMethod · 0.95
testStoreLoadMultipleMethod · 0.95
testStoreLoadSplitMethod · 0.95
testNativeMethod · 0.95
testFilterMethod · 0.95
testGroupByMethod · 0.95
testJoinMethod · 0.95
testBloomJoinMethod · 0.95
testBloomJoinUnionMethod · 0.95
testBloomJoinSplitMethod · 0.95

Calls 11

buildPpMethod · 0.95
compileMethod · 0.95
standardizeNewlineMethod · 0.95
sortUDFsMethod · 0.95
removeSignatureMethod · 0.95
closeMethod · 0.65
visitMethod · 0.45
toStringMethod · 0.45
writeMethod · 0.45
readMethod · 0.45
assertEqualsMethod · 0.45

Tested by

no test coverage detected