[ 
https://issues.apache.org/jira/browse/HIVE-15473?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15820437#comment-15820437
 ] 

anishek edited comment on HIVE-15473 at 1/12/17 8:27 AM:
---------------------------------------------------------

We cant use TOpeartionState as those state names are used to display the states 
in progress bar, we need to allow states as  'java.lang.String' as this will 
allow progress bar for any other execution engine to be displayed, The 
rendering of the progress bar does not care about the HiveServer State 
representations but rather for, the execution engine state representations. 

Since we also need to know on the client side when to stop querying for the 
progressBar the internal execution engine states have to be mapped to 
JobExecutionStatus. For now since progress bar is only for tez the matching 
happens via the 'fromString' method in JobExecutionStatus. Ideally this class 
should do the relevant mapping. Idea about how this could be achieved is here :

{code}

public enum JobExecutionStatus {
  SUBMITTED((short) 0),

  INITING((short) 1),

  RUNNING((short) 2),

  SUCCEEDED((short) 3),

  KILLED((short) 4),

  FAILED((short) 5),

  ERROR((short) 6),

  NOT_AVAILABLE((short) 7);

  private final short executionStatusOrdinal;

  JobExecutionStatus(short executionStatusOrdinal) {
    this.executionStatusOrdinal = executionStatusOrdinal;
  }

  public short toExecutionStatus() {
    return executionStatusOrdinal;
  }

  public static JobExecutionStatus fromString(String input, StatusFinder 
finder) {
    return finder.from(input);
  }

  interface StatusFinder {
    JobExecutionStatus from(String inputStatus);
  }

  static class TezStatusFinder implements StatusFinder {

    @Override
    public JobExecutionStatus from(String inputStatus) {
      for (JobExecutionStatus status : values()) {
        if (status.name().equals(inputStatus))
          return status;
      }
      return NOT_AVAILABLE;
    }
  }
}
{code}


was (Author: anishek):
We cant use TOpeartionState as those state names are used to display the states 
in progress bar, we need to allow states as  'java.lang.String' as this will 
allow progress bar for any other execution engine to be displayed, The 
rendering of the progress bar does not care about the HiveServer State 
representations but rather for, the execution engine state representations. 

> Progress Bar on Beeline client
> ------------------------------
>
>                 Key: HIVE-15473
>                 URL: https://issues.apache.org/jira/browse/HIVE-15473
>             Project: Hive
>          Issue Type: Improvement
>          Components: Beeline, HiveServer2
>    Affects Versions: 2.1.1
>            Reporter: anishek
>            Assignee: anishek
>            Priority: Minor
>         Attachments: HIVE-15473.2.patch, HIVE-15473.3.patch, 
> HIVE-15473.4.patch, screen_shot_beeline.jpg
>
>
> Hive Cli allows showing progress bar for tez execution engine as shown in 
> https://issues.apache.org/jira/secure/attachment/12678767/ux-demo.gif
> it would be great to have similar progress bar displayed when user is 
> connecting via beeline command line client as well. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to