[ 
https://issues.apache.org/jira/browse/HIVE-19220?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

shengsiwei updated HIVE-19220:
------------------------------
    Description: 
I find  duplicate code in Driver.java. We need to eliminate duplicate code to 
improve the simplicity of the code

 

Before modification
{code:java}
PerfLogger perfLogger = null;
if (!alreadyCompiled) {
 // compile internal will automatically reset the perf logger
 compileInternal(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));
}

{code}
 

After  modification 

 
{code:java}
PerfLogger perfLogger = SessionState.getPerfLogger();

if (!alreadyCompiled)

{ // compile internal will automatically reset the perf logger 
compileInternal(command, true); }

else

{ // Since we're reusing the compiled plan, we need to update its start time 
for current run 
plan.setQueryStartTime(perfLogger.getStartTime(PerfLogger.DRIVER_RUN)); }

{code}

 

 

 

  was:
I find  duplicate code in Driver.java. We need to eliminate duplicate code to 
improve the simplicity of the code

 

Before modification
{code:java}
PerfLogger perfLogger = null;
if (!alreadyCompiled) {
 // compile internal will automatically reset the perf logger
 compileInternal(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));
}

{code}
 

After  modification 

 
{code:java}
PerfLogger perfLogger = SessionState.getPerfLogger();

if (!alreadyCompiled)

{ // compile internal will automatically reset the perf logger 
compileInternal(command, true); }

else

{ // Since we're reusing the compiled plan, we need to update its start time 
for current run 
plan.setQueryStartTime(perfLogger.getStartTime(PerfLogger.DRIVER_RUN)); }

{code}

 

 

 


> perfLogger = SessionState.getPerfLogger() in Driver.java need to combine
> ------------------------------------------------------------------------
>
>                 Key: HIVE-19220
>                 URL: https://issues.apache.org/jira/browse/HIVE-19220
>             Project: Hive
>          Issue Type: Improvement
>    Affects Versions: 3.1.0
>            Reporter: shengsiwei
>            Assignee: shengsiwei
>            Priority: Minor
>         Attachments: HIVE-19220.1.patch
>
>
> I find  duplicate code in Driver.java. We need to eliminate duplicate code to 
> improve the simplicity of the code
>  
> Before modification
> {code:java}
> PerfLogger perfLogger = null;
> if (!alreadyCompiled) {
>  // compile internal will automatically reset the perf logger
>  compileInternal(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));
> }
> {code}
>  
> After  modification 
>  
> {code:java}
> PerfLogger perfLogger = SessionState.getPerfLogger();
> if (!alreadyCompiled)
> { // compile internal will automatically reset the perf logger 
> compileInternal(command, true); }
> else
> { // Since we're reusing the compiled plan, we need to update its start time 
> for current run 
> plan.setQueryStartTime(perfLogger.getStartTime(PerfLogger.DRIVER_RUN)); }
> {code}
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to