You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by prasadns14 <gi...@git.apache.org> on 2017/11/02 18:39:20 UTC

[GitHub] drill pull request #1021: DRILL-5923: Display name for query state

GitHub user prasadns14 opened a pull request:

    https://github.com/apache/drill/pull/1021

    DRILL-5923: Display name for query state

    Defined display names for query state. 
    @paul-rogers please review

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/prasadns14/drill DRILL-5922

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/drill/pull/1021.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1021
    
----
commit 39c5e18c705728a9c47b827a18f5cd44d53dde27
Author: Prasad Nagaraj Subramanya <pr...@gmail.com>
Date:   2017-11-02T18:36:53Z

    DRILL-5923: Display name for query state

----


---

[GitHub] drill pull request #1021: DRILL-5923: Display name for query state

Posted by arina-ielchiieva <gi...@git.apache.org>.
Github user arina-ielchiieva commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1021#discussion_r149596833
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/QueryStateDisplayName.java ---
    @@ -0,0 +1,35 @@
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + * http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.drill.exec.server.rest.profile;
    +
    +import org.apache.drill.exec.proto.UserBitShared.QueryResult.QueryState;
    +
    +public class QueryStateDisplayName {
    --- End diff --
    
    Let's name this class more generically since in future we might wan't add some other helper methods as well. 
    For example, `ProfileUtil`.


---

[GitHub] drill pull request #1021: DRILL-5923: Display name for query state

Posted by prasadns14 <gi...@git.apache.org>.
Github user prasadns14 commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1021#discussion_r148963451
  
    --- Diff: exec/java-exec/src/main/resources/rest/profile/profile.ftl ---
    @@ -135,6 +135,8 @@ table.sortable thead .sorting_desc { background-image: url("/static/img/black-de
     
       <#assign queueName = model.getProfile().getQueueName() />
       <#assign queued = queueName != "" && queueName != "-" />
    +  <#assign queryStateDisplayName = ["Starting", "Running", "Succeeded", "Canceled", "Failed",
    --- End diff --
    
    Yes, I could create a common freemarker function. But if the changes are not made in ProfileResources.java then the REST API /profile will still show the query state as "COMPLETED". It won't be in sync with the UI.


---

[GitHub] drill issue #1021: DRILL-5923: Display name for query state

Posted by prasadns14 <gi...@git.apache.org>.
Github user prasadns14 commented on the issue:

    https://github.com/apache/drill/pull/1021
  
    @arina-ielchiieva, @paul-rogers 
    Reverted to the array approach, also added documentation.


---

[GitHub] drill issue #1021: DRILL-5923: Display name for query state

Posted by prasadns14 <gi...@git.apache.org>.
Github user prasadns14 commented on the issue:

    https://github.com/apache/drill/pull/1021
  
    @arina-ielchiieva, made changes to avoid display name duplication. Please review


---

[GitHub] drill pull request #1021: DRILL-5923: Display name for query state

Posted by prasadns14 <gi...@git.apache.org>.
Github user prasadns14 commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1021#discussion_r149844423
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/QueryStateDisplayName.java ---
    @@ -0,0 +1,35 @@
    +/**
    --- End diff --
    
    will fix it


---

[GitHub] drill pull request #1021: DRILL-5923: Display name for query state

Posted by arina-ielchiieva <gi...@git.apache.org>.
Github user arina-ielchiieva commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1021#discussion_r148967310
  
    --- Diff: exec/java-exec/src/main/resources/rest/profile/profile.ftl ---
    @@ -135,6 +135,8 @@ table.sortable thead .sorting_desc { background-image: url("/static/img/black-de
     
       <#assign queueName = model.getProfile().getQueueName() />
       <#assign queued = queueName != "" && queueName != "-" />
    +  <#assign queryStateDisplayName = ["Starting", "Running", "Succeeded", "Canceled", "Failed",
    --- End diff --
    
    Prasad, maybe you can come up with different way to avoid display names duplication?


---

[GitHub] drill issue #1021: DRILL-5923: Display name for query state

Posted by arina-ielchiieva <gi...@git.apache.org>.
Github user arina-ielchiieva commented on the issue:

    https://github.com/apache/drill/pull/1021
  
    @paul-rogers totally agree with your comments about public API (slipped from my mind when I was writing comment yesterday). I guess then it's fine to go with changes Prasad suggests, I just have left a couple of suggestions to make code clearer.


---

[GitHub] drill pull request #1021: DRILL-5923: Display name for query state

Posted by prasadns14 <gi...@git.apache.org>.
Github user prasadns14 commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1021#discussion_r148945878
  
    --- Diff: exec/java-exec/src/main/resources/rest/profile/profile.ftl ---
    @@ -135,6 +135,8 @@ table.sortable thead .sorting_desc { background-image: url("/static/img/black-de
     
       <#assign queueName = model.getProfile().getQueueName() />
       <#assign queued = queueName != "" && queueName != "-" />
    +  <#assign queryStateDisplayName = ["Starting", "Running", "Succeeded", "Canceled", "Failed",
    --- End diff --
    
    Query state is displayed in two places - list.ftl (accessed via ProfileResources.java) and profile.ftl (accessed via QueryProfile.proto). So, I had to duplicate the array once in ProfileResources.java & once in profile.ftl


---

[GitHub] drill pull request #1021: DRILL-5923: Display name for query state

Posted by arina-ielchiieva <gi...@git.apache.org>.
Github user arina-ielchiieva commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1021#discussion_r148961643
  
    --- Diff: exec/java-exec/src/main/resources/rest/profile/profile.ftl ---
    @@ -135,6 +135,8 @@ table.sortable thead .sorting_desc { background-image: url("/static/img/black-de
     
       <#assign queueName = model.getProfile().getQueueName() />
       <#assign queued = queueName != "" && queueName != "-" />
    +  <#assign queryStateDisplayName = ["Starting", "Running", "Succeeded", "Canceled", "Failed",
    --- End diff --
    
    Maybe you can create common freemarker function which list.ftl and profile.ftl will use to decode the state name thus we won't duplicate display names and always be sure they are in sync.


---

[GitHub] drill issue #1021: DRILL-5923: Display name for query state

Posted by paul-rogers <gi...@git.apache.org>.
Github user paul-rogers commented on the issue:

    https://github.com/apache/drill/pull/1021
  
    @arina-ielchiieva, @prasadns14, here is my two cents.
    
    The names and numbers used in the protobuf definitions are part of Drill's public network API. This API is not versioned, so we can't really change it. If we changed the names, then, say, C-code or Java code that expects the old names will break. Being part of the public API, that code may not even be in the Drill source tree; perhaps someone has generated, say, a Python binding. So, can't change the public API.
    
    For purely aesthetic reasons, the contributor wishes to change the message displayed in the UI. This is purely a UI decision (the user is not expected to map the display names to the Protobuf enums.) And, the display name is subject to change. Maybe other UIs want to use other names. Maybe we want to show icons, or abbreviate the names ("Fail", "OK", etc.) And, of course, what if the display name should have spaces other characters: "In Progress", "In Queue" or "Didn't Work!". Can't put those in enum names. You get the idea.
    
    For this reason, the mapping from enum values to display names should be part of the UI, not the network protocol definition. The present change provides a UI-specific mapping from API Protobuf enum values to display strings, which seems like a good idea.
    
    So, the key questions are:
    
    * Should we use display strings other than the Protobuf constants (seems a good idea.)
    * Should we do the mapping in Java or in Freemarker? (Java seems simpler.)
    
    Thoughts?


---

[GitHub] drill issue #1021: DRILL-5923: Display name for query state

Posted by paul-rogers <gi...@git.apache.org>.
Github user paul-rogers commented on the issue:

    https://github.com/apache/drill/pull/1021
  
    @arina-ielchiieva, it helps to think about the source of the enum. This is a Protobuf enum. The ordinal values cannot change; they are a contract between sender and receiver. We can add new ones, or retire old ones, but otherwise the values are frozen in time.
    
    The array approach captures this reality. We could document the array better:
    ```
    String displayNames[] = {
      "First Value", // FIRST_VALUE = 0
      "Second Value", // SECOND_VALUE = 1
      ...
    };
    ```
    We can also do a bounds check:
    ```
    if (enumValue.ordinal() >= displayNames.length) {
      return enumValue.toString();
    else
      return displayNames[enumValue.ordinal());
    }
    ```
    But, IMHO a map seems overkill for such a simple task. Yes, it works, but is unnecessary. As they say, "make it as simple as possible (but no simpler)."


---

[GitHub] drill pull request #1021: DRILL-5923: Display name for query state

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/drill/pull/1021


---

[GitHub] drill pull request #1021: DRILL-5923: Display name for query state

Posted by arina-ielchiieva <gi...@git.apache.org>.
Github user arina-ielchiieva commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1021#discussion_r149998367
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/ProfileUtil.java ---
    @@ -0,0 +1,57 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + * http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.drill.exec.server.rest.profile;
    +
    +import org.apache.drill.exec.proto.UserBitShared.QueryResult.QueryState;
    +
    +import java.util.Collections;
    +import java.util.Map;
    +
    +import com.google.common.collect.Maps;
    +
    +public class ProfileUtil {
    +  // Mapping query state names to display names
    +  private static final Map<String, String> queryStateDisplayName;
    +
    +  static {
    +    Map<String, String> displayNames = Maps.newHashMap();
    +    displayNames.put("STARTING", "Starting");
    +    displayNames.put("RUNNING", "Running");
    +    displayNames.put("COMPLETED", "Succeeded");
    +    displayNames.put("CANCELED", "Canceled");
    +    displayNames.put("FAILED", "Failed");
    +    displayNames.put("CANCELLATION_REQUESTED", "Cancellation Requested");
    +    displayNames.put("ENQUEUED", "Enqueued");
    +    queryStateDisplayName = Collections.unmodifiableMap(displayNames);
    +  }
    +
    +
    +  /**
    +   * Utility to return display name for query state
    +   * @param queryState
    +   * @return display string for query state
    +   */
    +  public final static String getQueryStateDisplayName(QueryState queryState) {
    +    String state = queryState.name();
    +    if (queryStateDisplayName.containsKey(state)) {
    --- End diff --
    
    This would be more optimal:
    ```
    String state = queryStateDisplayNames.get(queryState);
    if (state == null) {
       state = "Unknown State"
    }
    return state;
    ```


---

[GitHub] drill pull request #1021: DRILL-5923: Display name for query state

Posted by arina-ielchiieva <gi...@git.apache.org>.
Github user arina-ielchiieva commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1021#discussion_r149997750
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/ProfileUtil.java ---
    @@ -0,0 +1,57 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + * http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.drill.exec.server.rest.profile;
    +
    +import org.apache.drill.exec.proto.UserBitShared.QueryResult.QueryState;
    +
    +import java.util.Collections;
    +import java.util.Map;
    +
    +import com.google.common.collect.Maps;
    +
    +public class ProfileUtil {
    +  // Mapping query state names to display names
    +  private static final Map<String, String> queryStateDisplayName;
    +
    +  static {
    +    Map<String, String> displayNames = Maps.newHashMap();
    --- End diff --
    
    1. Please use `Map<QueryState, String>` since you're already receiving `QueryState` as in parameter in method.
    Besides, it would guarantee you did not make mistake writing query state enum names.
    2. `queryStateDisplayName` -> `queryStateDisplayNames`


---

[GitHub] drill pull request #1021: DRILL-5923: Display name for query state

Posted by arina-ielchiieva <gi...@git.apache.org>.
Github user arina-ielchiieva commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1021#discussion_r149596636
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/QueryStateDisplayName.java ---
    @@ -0,0 +1,35 @@
    +/**
    --- End diff --
    
    Please use comment, not Java doc for header.


---

[GitHub] drill pull request #1021: DRILL-5923: Display name for query state

Posted by arina-ielchiieva <gi...@git.apache.org>.
Github user arina-ielchiieva commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1021#discussion_r149889024
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/QueryStateDisplayName.java ---
    @@ -0,0 +1,35 @@
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + * http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.drill.exec.server.rest.profile;
    +
    +import org.apache.drill.exec.proto.UserBitShared.QueryResult.QueryState;
    +
    +public class QueryStateDisplayName {
    +  // Values should correspond to the QueryState enum in UserBitShared.proto
    --- End diff --
    
    @prasadns14 
    1. When using array you depend on enum value order. If for some reason value order changes, your approach will be working incorrectly.
    2. Having map will show which key is mapped to which value and it will be much easier to understand that, for example, completed is mapped to succeeded.
    
    I recommend you use map approach.


---

[GitHub] drill issue #1021: DRILL-5923: Display name for query state

Posted by arina-ielchiieva <gi...@git.apache.org>.
Github user arina-ielchiieva commented on the issue:

    https://github.com/apache/drill/pull/1021
  
    Well, I don't have strong preference here, we can use array, as long as Prasad makes it nicely documented as in your example rather then in one line.
    ```
    String displayNames[] = {
      "First Value", // FIRST_VALUE = 0
      "Second Value", // SECOND_VALUE = 1
      ...
    };
    ```


---

[GitHub] drill issue #1021: DRILL-5923: Display name for query state

Posted by prasadns14 <gi...@git.apache.org>.
Github user prasadns14 commented on the issue:

    https://github.com/apache/drill/pull/1021
  
    @arina-ielchiieva, please review


---

[GitHub] drill pull request #1021: DRILL-5923: Display name for query state

Posted by arina-ielchiieva <gi...@git.apache.org>.
Github user arina-ielchiieva commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1021#discussion_r148860361
  
    --- Diff: exec/java-exec/src/main/resources/rest/profile/profile.ftl ---
    @@ -135,6 +135,8 @@ table.sortable thead .sorting_desc { background-image: url("/static/img/black-de
     
       <#assign queueName = model.getProfile().getQueueName() />
       <#assign queued = queueName != "" && queueName != "-" />
    +  <#assign queryStateDisplayName = ["Starting", "Running", "Succeeded", "Canceled", "Failed",
    --- End diff --
    
    Why do we have need duplicated state display name array here and in `ProfileResources.java`. Is there a possibility to not duplicate it?


---

[GitHub] drill pull request #1021: DRILL-5923: Display name for query state

Posted by prasadns14 <gi...@git.apache.org>.
Github user prasadns14 commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1021#discussion_r149974787
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/QueryStateDisplayName.java ---
    @@ -0,0 +1,35 @@
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + * http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.drill.exec.server.rest.profile;
    +
    +import org.apache.drill.exec.proto.UserBitShared.QueryResult.QueryState;
    +
    +public class QueryStateDisplayName {
    +  // Values should correspond to the QueryState enum in UserBitShared.proto
    --- End diff --
    
    @arina-ielchiieva 
    yes, map will definitely make it to easier to visualize the mapping. 
    Made the changes


---

[GitHub] drill pull request #1021: DRILL-5923: Display name for query state

Posted by prasadns14 <gi...@git.apache.org>.
Github user prasadns14 commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1021#discussion_r149844559
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/QueryStateDisplayName.java ---
    @@ -0,0 +1,35 @@
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + * http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.drill.exec.server.rest.profile;
    +
    +import org.apache.drill.exec.proto.UserBitShared.QueryResult.QueryState;
    +
    +public class QueryStateDisplayName {
    --- End diff --
    
    sure will give a generic name


---

[GitHub] drill pull request #1021: DRILL-5923: Display name for query state

Posted by prasadns14 <gi...@git.apache.org>.
Github user prasadns14 commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1021#discussion_r149846069
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/QueryStateDisplayName.java ---
    @@ -0,0 +1,35 @@
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + * http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.drill.exec.server.rest.profile;
    +
    +import org.apache.drill.exec.proto.UserBitShared.QueryResult.QueryState;
    +
    +public class QueryStateDisplayName {
    +  // Values should correspond to the QueryState enum in UserBitShared.proto
    --- End diff --
    
    QueryState is an enum.
    I feel having an array is simple. We could use the QueryState ordinal as index to fetch the display name from the array. I can add a check to check for array index overflow, and return some default value like "Unknown state".


---

[GitHub] drill pull request #1021: DRILL-5923: Display name for query state

Posted by arina-ielchiieva <gi...@git.apache.org>.
Github user arina-ielchiieva commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1021#discussion_r149596974
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/QueryStateDisplayName.java ---
    @@ -0,0 +1,35 @@
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + * http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.drill.exec.server.rest.profile;
    +
    +import org.apache.drill.exec.proto.UserBitShared.QueryResult.QueryState;
    +
    +public class QueryStateDisplayName {
    +  // Values should correspond to the QueryState enum in UserBitShared.proto
    --- End diff --
    
    Not quite right, value do not correspond to QueryState enum, it's rather a mapping to QueryState enum. To be more clear here I suggest you create a map with `QueryState` as a key and `String` as value:
    ```
    STARTING -> Starting
    COMPLETED -> Succeeded
    ```
    Thus you'll be able to get desired representation value by `QueryState` and in case if value is null return some default, like `Unknown State`.


---

[GitHub] drill issue #1021: DRILL-5923: Display name for query state

Posted by arina-ielchiieva <gi...@git.apache.org>.
Github user arina-ielchiieva commented on the issue:

    https://github.com/apache/drill/pull/1021
  
    @prasadns14 as far as I understood, you made all these changes to replace `completed` with `succeeded`. What if you just make changes in State enum itself, refactor some code and thus no changes in rest part will be required? 
    From UserBitShared.proto
    ```
    	enum QueryState {
    	  STARTING = 0; // query has been scheduled for execution. This is post-enqueued.
    	  RUNNING = 1;
    	  COMPLETED = 2; // query has completed successfully
    	  CANCELED = 3; // query has been cancelled, and all cleanup is complete
    	  FAILED = 4;
    	  CANCELLATION_REQUESTED = 5; // cancellation has been requested, and is being processed
    	  ENQUEUED = 6; // query has been enqueued. this is pre-starting.
    	}
    ```
    After the renaming, please don't forget to regenerate protobuf.


---