/** * Provide information on how a pig query will be executed. For now * this information is very developer focussed, and probably not very * useful to the average user. * @param alias Name of alias to explain. * @param stream PrintStream to write explanation to. * @throws IOException if the requested alias cannot be found. */ public void explain(String alias, PrintStream stream) throws IOException { explain(alias, "text", true, false, stream, stream, null, null); }
/** * Explain this pipeline. Results will be printed to stdout. * @throws IOException if explain fails. */ public void explain() throws IOException { if (queries.isEmpty()) { LOG.info("No bound query to explain"); return; } PigServer pigServer = new PigServer(scriptContext.getPigContext(), false); registerQueryForDiagnostics(pigServer, queries.get(0)); pigServer.explain(null, System.out); }
String suffix = mExplain.mTime+sCount+"."+mExplain.mFormat; lp = new PrintStream(new File(file, "logical_plan-"+suffix)); mPigServer.explain(mExplain.mAlias, mExplain.mFormat, mExplain.mVerbose, markAsExecuted, lp, null, file, suffix); lp.close(); boolean append = !(mExplain.mCount==1); lp = ep = new PrintStream(new FileOutputStream(mExplain.mTarget, append)); mPigServer.explain(mExplain.mAlias, mExplain.mFormat, mExplain.mVerbose, markAsExecuted, lp, ep, null, null); lp.close(); mPigServer.explain(mExplain.mAlias, mExplain.mFormat, mExplain.mVerbose, markAsExecuted, lp, ep, null, null);