//编译和执行程序同级别在该方法中调用privatevoidrunInternal(String command,boolean alreadyCompiled)throwsCommandProcessorResponse{if(!alreadyCompiled){// compile internal will automatically reset the perf logger// 调用compileInternal方法把SQL编译为QueryPlancompileInternal(command,true);//进行解析、编译、优化// then we continue to use this perf logger
perfLogger =SessionState.getPerfLogger();}else{// reuse existing perf logger.
perfLogger =SessionState.getPerfLogger();// Since we're reusing the compiled plan, we need to update its start time for current run
plan.setQueryStartTime(perfLogger.getStartTime(PerfLogger.DRIVER_RUN));}try{// 调用execute执行QueryPlan中的所有taskexecute();}catch(CommandProcessorResponse cpr){rollback(cpr);throw cpr;}}