You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by su...@apache.org on 2016/11/18 19:13:43 UTC
drill git commit: DRILL-5047: When session option is string,
query profile is displayed incorrectly on Web UI
Repository: drill
Updated Branches:
refs/heads/master 4b1902c04 -> 35275536c
DRILL-5047: When session option is string, query profile is displayed incorrectly on Web UI
closes #655
Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/35275536
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/35275536
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/35275536
Branch: refs/heads/master
Commit: 35275536c4a000b5e995769b893505928361d17c
Parents: 4b1902c
Author: Arina Ielchiieva <ar...@gmail.com>
Authored: Thu Nov 17 12:44:34 2016 +0000
Committer: Sudheesh Katkam <su...@apache.org>
Committed: Fri Nov 18 10:21:41 2016 -0800
----------------------------------------------------------------------
.../server/rest/profile/ProfileWrapper.java | 20 ++++++++++++++++++--
.../src/main/resources/rest/profile/profile.ftl | 9 +++++----
2 files changed, 23 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/drill/blob/35275536/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/ProfileWrapper.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/ProfileWrapper.java b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/ProfileWrapper.java
index 84cff7a..d9edf3a 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/ProfileWrapper.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/ProfileWrapper.java
@@ -24,6 +24,7 @@ import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.collect.Maps;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.drill.exec.proto.UserBitShared.CoreOperatorType;
import org.apache.drill.exec.proto.UserBitShared.MajorFragmentProfile;
@@ -32,6 +33,7 @@ import org.apache.drill.exec.proto.UserBitShared.OperatorProfile;
import org.apache.drill.exec.proto.UserBitShared.QueryProfile;
import org.apache.drill.exec.proto.helper.QueryIdHelper;
import org.apache.drill.exec.server.options.OptionList;
+import org.apache.drill.exec.server.options.OptionValue;
import static com.fasterxml.jackson.databind.SerializationFeature.INDENT_OUTPUT;
@@ -150,7 +152,21 @@ public class ProfileWrapper {
return sb.append("}").toString();
}
- public OptionList getOptionList() {
- return options;
+ /**
+ * Generates sorted map with properties used to display on Web UI,
+ * where key is property name and value is property string value.
+ * When property value is null, it would be replaced with 'null',
+ * this is achieved using {@link String#valueOf(Object)} method.
+ * Options will be stored in ascending key order, sorted according
+ * to the natural order for the option name represented by {@link String}.
+ *
+ * @return map with properties names and string values
+ */
+ public Map<String, String> getOptions() {
+ final Map<String, String> map = Maps.newTreeMap();
+ for (OptionValue option : options) {
+ map.put(option.getName(), String.valueOf(option.getValue()));
+ }
+ return map;
}
}
http://git-wip-us.apache.org/repos/asf/drill/blob/35275536/exec/java-exec/src/main/resources/rest/profile/profile.ftl
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/resources/rest/profile/profile.ftl b/exec/java-exec/src/main/resources/rest/profile/profile.ftl
index c0f2d8e..792739f 100644
--- a/exec/java-exec/src/main/resources/rest/profile/profile.ftl
+++ b/exec/java-exec/src/main/resources/rest/profile/profile.ftl
@@ -107,7 +107,8 @@
<p>FOREMAN: ${model.getProfile().getForeman().getAddress()}</p>
<p>TOTAL FRAGMENTS: ${model.getProfile().getTotalFragments()}</p>
- <#if (model.getOptionList()?size > 0)>
+ <#assign options = model.getOptions()>
+ <#if (options?keys?size > 0)>
<div class="page-header"></div>
<h3>Session Options</h3>
<div class="panel-group" id="session-options-accordion">
@@ -129,10 +130,10 @@
</tr>
</thead>
<tbody>
- <#list model.getOptionList() as option>
+ <#list options?keys as name>
<tr>
- <td>${option.getName()}</td>
- <td>${option.getValue()?c}</td>
+ <td>${name}</td>
+ <td>${options[name]}</td>
</tr>
</#list>
</tbody>